sync-engine
AGENTS.md1.1k starsChanged 7 months agoApache-2.0View on GitHub
Sync Stripe data to PostgreSQL (and other destinations) via a message-based protocol. Sources read from APIs, destinations write to databases, and the engine wires them together through typed async iterable streams. Connectors communicate via NDJSON when running as subprocesses. Before committing (CI enforces all three): Minimum Node.js version: 24. Dev with auto-rebuild: pnpm --filter sync-engine dev If you add a migration, register it in packages/state-postgres/src/migrations/index.ts. Sources and destinations are isolated connectors that only depend on protocol and approved shared utilities…
- Reads credentials
- Installs packages
Trending
More talk lately.thin dataabout the whole repository
Who's talking about stripe/sync-engine
- supabase/supabase“The documentation around the recent Stripe announcements is incorrect, nonsensical and missing.”GitHub · May 27, 2026 · 1 reactions
- supabase/supabase“docs(www): update Stripe Sync Engine repository link”GitHub · Oct 2, 2026
- supabase/supabase“Schema drift with stripe/sync-engine”GitHub · May 15, 2026
- stripe/sync-engine-fork“Potential fix for code scanning alert no. 5: Information exposure through a stack trace”GitHub · Mar 30, 2026
- stripe/sync-engine-fork“Potential fix for code scanning alert no. 16: Workflow does not contain permissions”GitHub · Mar 30, 2026
The biggest 5 of 11 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 11
Talked about on GitHub (11 times).
On GitHub · 11
- May 27, 2026The documentation around the recent Stripe announcements is incorrect, nonsensical and missing. — supabase/supabase1 reaction · 2 comments
- Oct 2, 2026docs(www): update Stripe Sync Engine repository link — supabase/supabase0 reactions · 4 comments
- May 15, 2026Schema drift with stripe/sync-engine — supabase/supabase0 reactions · 2 comments
- Mar 30, 2026Potential fix for code scanning alert no. 5: Information exposure through a stack trace — stripe/sync-engine-fork0 reactions · 1 comment
- Mar 30, 2026Potential fix for code scanning alert no. 16: Workflow does not contain permissions — stripe/sync-engine-fork0 reactions · 1 comment
6 more on GitHub
- Mar 30, 2026Potential fix for code scanning alert no. 3: Workflow does not contain permissions — stripe/sync-engine-fork0 reactions · 1 comment
- Mar 30, 2026Potential fix for code scanning alert no. 2: Workflow does not contain permissions — stripe/sync-engine-fork0 reactions · 1 comment
- Mar 30, 2026Potential fix for code scanning alert no. 1: Workflow does not contain permissions — stripe/sync-engine-fork0 reactions · 1 comment
- Mar 28, 2026`stripe_worker` not checking `sync_job` for error status, not syncing for 7 days after an error occurs. — stripe/sync-engine-fork0 reactions · 1 comment
- Mar 12, 2026Remove stale SpecParser default comments from test-table-modes.ts — stripe/sync-engine-fork0 reactions · 2 comments
- Mar 11, 2026fix: remove validateAccessToken and check stripe key is set — stripe/sync-engine-fork0 reactions
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Before committing (CI enforces all three):
- Very specific: line 27
If you add a migration, register it in packages/state-postgres/src/migrations/index.ts.
- Distinctive: line 83
All serializable inputs/outputs (Zod schemas, JSON wire format) must use snake_case field names.
- Very specific: line 103
When creating git worktrees, always use .worktrees/ at the repo root — not .claude/worktrees/.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sync Engine
Sync Stripe data to PostgreSQL (and other destinations) via a message-based protocol. Sources read from APIs, destinations write to databases, and the engine wires them together through typed async iterable streams. Connectors communicate via NDJSON when running as subprocesses.
Quick Reference
pnpm install
pnpm build # required before running CLI or e2e tests
pnpm test # unit tests (no deps needed)
pnpm test:integration # needs local Postgres
pnpm test:e2e # needs Docker + Stripe API keys in .envBefore committing (CI enforces all three):
pnpm format # prettier
pnpm lint
pnpm buildMinimum Node.js version: 24. Dev with auto-rebuild: pnpm --filter sync-engine dev
If you add a migration, register it in packages/state-postgres/src/migrations/index.ts.
Architecture at a Glance
Sources and destinations are isolated connectors that only depend on protocol
and approved shared utilities (logger, openapi, util-postgres).
The engine loads connectors (in-process or subprocess), pipes source output through
destination input, and manages state checkpoints. See docs/architecture/packages.md
for the full dependency graph.
Package Map
| Package | Purpose | Depends on |
packages/protocol | Message types, Source/Destination interfaces, Zod schemas | zod, citty, ix |
packages/openapi | Stripe OpenAPI spec fetching and parsing | zod |
packages/logger | Structured logging (pino) + progress UI (ink) | pino, ink; peer: protocol |
packages/source-stripe | Stripe API source connector | protocol, openapi, logger |
packages/destination-postgres | Postgres destination connector | protocol, util-postgres, logger |
packages/destination-google-sheets | Google Sheets destination connector | protocol, logger |
packages/state-postgres | Postgres state store + migrations | util-postgres, logger |
packages/util-postgres | Shared Postgres utilities (upsert, rate limiter) | logger, pg |
packages/hono-zod-openapi | Hono + zod-openapi integration for spec generation | hono, zod, zod-openapi |
packages/test-utils | Shared test helpers (servers, seeds, fixtures) | destination-postgres, openapi, pg |
packages/ts-cli | Generic TypeScript module CLI runner | citty |
apps/engine | Sync engine library + stateless CLI + HTTP API | protocol, connectors, state-postgres |
apps/service | Pipeline management + Temporal workflows | engine, Temporal SDK |
apps/dashboard | React web UI for pipeline management | openapi-fetch, radix-ui |
apps/visualizer | Next.js data visualization tool | next, source-stripe, pglite |
apps/supabase | Supabase edge functions (Deno runtime) | protocol, engine, connectors |
e2e/ | Cross-package conformance and layer tests | all packages |
Key Rules
- This file is an index, not a rulebook — before adding anything here, check if it belongs in docs/architecture/principles.md, docs/architecture/decisions.md, or another doc first. Only add to AGENTS.md if no better home exists.
- Connector isolation — sources never import destinations, both depend only on
protocol+ approved shared utilities. Enforced bye2e/layers.test.ts. - State is a message — connectors never access state storage directly. State in =
cursor_in; state out =SourceStateMessage. - Snake_case on the wire — all Zod schemas and JSON wire format use snake_case.
- api_version is required — always mandatory in Stripe source config. Never optional.
- Tests fail loud — no silent skips when dependencies are unavailable.
See docs/architecture/principles.md for the complete list.
Where to Find Things
- Architecture & layers: docs/architecture/
- Design decisions: docs/architecture/decisions.md
- Engine internals: docs/engine/
- Service internals: docs/service/
- Plans & RFCs: docs/plans/
- Guides (CLI, publishing, tsconfig): docs/guides/
- OpenAPI specs:
apps/{engine,service}/src/__generated__/openapi.json - CI: .github/workflows/ci.yml
Conventions
- All serializable inputs/outputs (Zod schemas, JSON wire format) must use snake_case field names.
- Source connectors must use
console.errorfor logging (stdout is the NDJSON stream). - Generated OpenAPI specs live in each package's
src/__generated__/openapi.json. Run./scripts/generate-openapi.shand commit the output before pushing when schemas change. Never edit generated files by hand. - Non-trivial PRs should be accompanied by a plan artifact in
docs/plans/YYYY-MM-DD-<slug>.md. Save it before or alongside the first implementation commit.
Debugging
- Debugging the sync CLI — subprocess log location, pnpm store staleness, dist vs bun condition.
Key Gotchas
- No build step for local dev — the sync CLI uses
--conditions bun --import tsxso it reads.tssource directly. Edits to workspace packages propagate immediately.pnpm buildis only needed for vitest (which resolvesdist/) and Docker. - Do NOT add
injectWorkspacePackages: truetopnpm-workspace.yaml— it copies files into the pnpm store as hardlinks, which break silently when editors save (write-temp-then-rename). Without it, pnpm uses symlinks and edits always propagate. Docker builds usepnpm deploy --legacyinstead. tsxfails onapps/supabase—?rawimports pull in Deno-only code. Other packages work fine withnpx tsx.packages/sync-engine/src/supabaseis Deno, not Node. Don't run those files with Node/tsx.- E2E tests need Stripe keys with write permissions (they create real objects).
- The npm-bundled
esbuildbinary is blocked by Santa (endpoint security). SetESBUILD_BINARY_PATHto the Homebrew-installed binary:source scripts/prefer-system-esbuild.shor add it to your.envrc.apps/supabase/build.mjsauto-detects the system binary, but tools likeviteandtsxneed the env var set in the shell.
Worktrees
When creating git worktrees, always use .worktrees/ at the repo root — not .claude/worktrees/.
git worktree add .worktrees/<name> <branch>Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

