| name | scaffold-stratasync |
| description | Scaffolds a complete Strata Sync app: a Next.js client and a Fastify + PostgreSQL sync server, with models, IndexedDB persistence, WebSocket deltas and the bootstrap/mutate routes wired up. Strata Sync is an open-source implementation of Linear's sync engine, so the vocabulary is Linear's (bootstrap, lastSyncId, delta packets, sync actions, sync groups, the transaction outbox). Use when asked to "scaffold stratasync", "create a stratasync app", "new stratasync project", "set up stratasync", "scaffold a sync app", "build an app like Linear", or "open source linear sync engine". For adding models, fields or sync groups to an app that already runs Strata Sync, use the stratasync skill instead. |
Scaffold a Strata Sync App
Generates a runnable local-first app: a Next.js client and a standalone Fastify API with PostgreSQL, converging over a server-sequenced log.
- IS: creating a new Strata Sync project from nothing, or adding the full client and server sync layer to an existing Next.js app.
- IS NOT: changing an app that already syncs (use the
stratasync skill), general Next.js scaffolding (use scaffold-nextjs), or deployment.
Strata Sync is a clean-room implementation of the architecture Linear published; it contains no Linear code. The reverse-engineering notes are the reference for the concepts named here.
Reference files
| File | Purpose |
|---|
references/client-setup.md | Next.js client: tsconfig, next.config, deps, model, client factory, providers, page |
references/server-setup.md | Fastify server: docker-compose, drizzle schema, server entry, config |
references/model-patterns.md | Adding models, instance methods (.save/.delete/.archive), relations, load strategies, server config |
Variables
| Variable | Description | Default |
|---|
{{PROJECT_NAME}} | Project directory and database name | my-stratasync-app |
{{MODEL_NAME}} | Primary model name (PascalCase) | Todo |
{{MODEL_NAME_LOWER}} | Model name (lowercase) | todo |
{{MODEL_TABLE}} | Database table name (plural lowercase) | todos |
{{API_PORT}} | Server port | 3001 |
{{WEB_PORT}} | Client dev port | 3002 |
Workflow
Phase 1: Gather info
Phase 2: Scaffold Next.js client
Phase 3: Scaffold server
Phase 4: Scaffold client sync layer
Write all client sync files per references/client-setup.md:
Phase 5: Scaffold example page
Phase 6: Start and verify
Anti-patterns
- Never omit
experimentalDecorators: true from tsconfig. Decorators fail silently.
- Never omit
transpilePackages from next.config. ESM imports break at runtime.
- Never forget side-effect model imports in the barrel file. Schema will be empty, no data syncs.
- Never install
@stratasync/server in the client app. It is server-only.
- Never import
@stratasync/next directly in client components. Use @stratasync/next/client.
- Never omit
"use client" on components that use hooks
- Never use
React.forwardRef. React 19+ passes ref as prop.
Skill handoffs
| When | Hand off to |
|---|
| User wants to add more models | Refer to references/model-patterns.md |
| User wants authentication | Beyond scaffold scope. Point to StrataSync server auth docs. |
| User wants deployment | Beyond scaffold scope. Standard Next.js + Node.js deployment. |
| User wants collaborative text editing | Point to @stratasync/y-doc package |