agentleFS
StripeKnown publisherstripe/sync-engine/AGENTS.md

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

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 8 mentionsApr 2026: 0 mentionsMay 2026: 2 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 1 mentionNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the stripe/sync-engine repository that our weekly crawl found: only 11 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about stripe/sync-engine

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

6 more on GitHub
  • 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.

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
  1. Distinctive:

    Before committing (CI enforces all three):

    line 17
  2. Very specific:

    If you add a migration, register it in packages/state-postgres/src/migrations/index.ts.

    line 27
  3. Distinctive:

    All serializable inputs/outputs (Zod schemas, JSON wire format) must use snake_case field names.

    line 83
  4. Very specific:

    When creating git worktrees, always use .worktrees/ at the repo root — not .claude/worktrees/.

    line 103

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 .env

Before committing (CI enforces all three):

pnpm format          # prettier
pnpm lint
pnpm build

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.

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

PackagePurposeDepends on
packages/protocolMessage types, Source/Destination interfaces, Zod schemaszod, citty, ix
packages/openapiStripe OpenAPI spec fetching and parsingzod
packages/loggerStructured logging (pino) + progress UI (ink)pino, ink; peer: protocol
packages/source-stripeStripe API source connectorprotocol, openapi, logger
packages/destination-postgresPostgres destination connectorprotocol, util-postgres, logger
packages/destination-google-sheetsGoogle Sheets destination connectorprotocol, logger
packages/state-postgresPostgres state store + migrationsutil-postgres, logger
packages/util-postgresShared Postgres utilities (upsert, rate limiter)logger, pg
packages/hono-zod-openapiHono + zod-openapi integration for spec generationhono, zod, zod-openapi
packages/test-utilsShared test helpers (servers, seeds, fixtures)destination-postgres, openapi, pg
packages/ts-cliGeneric TypeScript module CLI runnercitty
apps/engineSync engine library + stateless CLI + HTTP APIprotocol, connectors, state-postgres
apps/servicePipeline management + Temporal workflowsengine, Temporal SDK
apps/dashboardReact web UI for pipeline managementopenapi-fetch, radix-ui
apps/visualizerNext.js data visualization toolnext, source-stripe, pglite
apps/supabaseSupabase edge functions (Deno runtime)protocol, engine, connectors
e2e/Cross-package conformance and layer testsall packages

Key Rules

  1. 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.
  2. Connector isolation — sources never import destinations, both depend only on protocol + approved shared utilities. Enforced by e2e/layers.test.ts.
  3. State is a message — connectors never access state storage directly. State in = cursor_in; state out = SourceStateMessage.
  4. Snake_case on the wire — all Zod schemas and JSON wire format use snake_case.
  5. api_version is required — always mandatory in Stripe source config. Never optional.
  6. 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.error for logging (stdout is the NDJSON stream).
  • Generated OpenAPI specs live in each package's src/__generated__/openapi.json. Run ./scripts/generate-openapi.sh and 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 tsx so it reads .ts source directly. Edits to workspace packages propagate immediately. pnpm build is only needed for vitest (which resolves dist/) and Docker.
  • Do NOT add injectWorkspacePackages: true to pnpm-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 use pnpm deploy --legacy instead.
  • tsx fails on apps/supabase — ?raw imports pull in Deno-only code. Other packages work fine with npx tsx.
  • packages/sync-engine/src/supabase is 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 esbuild binary is blocked by Santa (endpoint security). Set ESBUILD_BINARY_PATH to the Homebrew-installed binary: source scripts/prefer-system-esbuild.sh or add it to your .envrc. apps/supabase/build.mjs auto-detects the system binary, but tools like vite and tsx need 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>

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.