Architecture
Architecture
How the API, worker, and shared layers fit together.
This section is a stub. Content is being written.
What goes here
A high-level walk-through of the moving parts of Sinatra:
- The API (
packages/api) — Fastify, stateless, receives Linear and GitHub webhooks, enqueues Temporal workflows. Deployable to Cloud Run. - The worker (
packages/worker) — Long-lived Temporal worker that hosts the agent workflow and activities. Deployable to GKE. - Shared (
packages/shared) — Prisma schema, OAuth, sandbox abstraction, agent engines,.sinatrarcparser, KMS envelope encryption, model router. - Tenant isolation — every tenant-scoped query goes through
TenantScopedDb(tenantId). The KMS data key per tenant bindstenantIdas AAD so cross-tenant decryption fails by construction. - Data flow — Linear webhook → API → Postgres + Temporal → worker → sandbox → agent → GitHub PR.
See the diagram and flow walkthrough for the full hot path.