Skip to content

feat(cli): integrate Stripe Sync Engine into local development#5510

Draft
avallete wants to merge 1 commit into
developfrom
claude/sharp-rubin-FVB6Q
Draft

feat(cli): integrate Stripe Sync Engine into local development#5510
avallete wants to merge 1 commit into
developfrom
claude/sharp-rubin-FVB6Q

Conversation

@avallete

@avallete avallete commented Jun 8, 2026

Copy link
Copy Markdown
Member

Adds support for running the Stripe Sync Engine container as part of the local Supabase stack. The engine syncs data from a Stripe account into a local stripe schema and runs its own migrations on startup.

Key Changes

  • StartStripeSyncEngine function: New function in apps/cli-go/internal/db/start/start.go that creates and starts the Stripe Sync Engine container with proper health checks, environment configuration, and network setup. The container is removed before startup to ensure migrations re-run on db reset.

  • Database setup integration: Modified SetupLocalDatabase to start the Stripe Sync Engine before applying user migrations, ensuring migrations that reference Stripe tables (e.g., foreign keys) can resolve them.

  • Service startup integration: Updated apps/cli-go/internal/start/start.go to start the engine when the volume already exists (skipping fresh setup).

  • Database reset integration: Modified apps/cli-go/internal/db/reset/reset.go to recreate the Stripe schema before applying migrations during reset.

  • Configuration support: Added stripeSync config struct in apps/cli-go/pkg/config/config.go with fields for enabled status, port, schema name, and Stripe credentials (API key, secret key, webhook secret). Credentials support environment variable substitution via env() syntax.

  • Docker and utilities: Updated apps/cli-go/internal/utils/config.go to track the Stripe Sync Engine container ID and aliases, and added the service to GetServices() for proper Docker image management.

  • Configuration template: Added [stripe_sync_engine] section to apps/cli-go/pkg/config/templates/config.toml with sensible defaults and documentation.

  • Status reporting: Extended apps/cli-go/internal/status/status.go to include Stripe Sync Engine URL in environment variable output.

  • Image constants: Added Stripe Sync Engine image reference to apps/cli-go/pkg/config/constants.go and Dockerfile.

  • Test coverage: Added comprehensive test in apps/cli-go/internal/db/start/stripe_sync_engine_test.go covering disabled state and healthy container startup.

Implementation Details

The Stripe Sync Engine is treated as an optional service that only starts when explicitly enabled in config. It uses a health check endpoint (/health) to verify readiness before migrations proceed. Credentials are only passed to the container if they resolve to concrete values (not env(...) references), allowing the engine to fall back to its own defaults. The service is always removed before startup to ensure a clean state for migrations on reset operations.

https://claude.ai/code/session_01Nj57x7hWw22iVfFMbHBXnV

Add the Stripe Sync Engine as an optional managed container in the local
stack so `supabase db reset` no longer fails when migrations reference
Stripe tables.

The Stripe Sync Engine owns the `stripe` schema and (re)creates it via its
own migrations on startup. Previously, `db reset` recreated the database
and applied user migrations before the engine had a chance to rebuild the
schema, so migrations with foreign keys into `stripe.*` failed.

The engine is now started and awaited healthy inside SetupLocalDatabase,
before MigrateAndSeed runs, which covers both the initial `start` and
`db reset` (and the legacy pg14 reset path). The container is recreated on
each setup so a reset re-runs the engine's migrations against the freshly
recreated database. Config lives under a new `[stripe_sync_engine]` block
(disabled by default), with the image pinned in the Dockerfile and wired
into ids, compose services, status output, and stop.

Closes CLI-1582
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 27143577379

Warning

No base build found for commit ec23369 on develop.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 64.065%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 15951
Covered Lines: 10219
Line Coverage: 64.06%
Coverage Strength: 7.11 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants