Decision 0017
A local stack that matches the server
accepted · 2026-11-08
Context
An app using a database (ADR 0015) and the backend kit (ADR 0016) has to run on a developer's
machine with the same database setup and the same auth schema it gets when deployed.
Otherwise problems only show up after a deploy.
Decision
- A CLI,
packages/cli, published to npm as thespotcraftcommand, used from an app's repository:dev startruns one local Postgres through Docker Compose (projectspotcraft-dev, a named volume,127.0.0.1:54322only). It then provisions the app's database and printsDATABASE_URLand a generatedAUTH_SECRET.dev stopkeeps the data;dev statusanddev envshow the settings.dev env --writeadds missing variables to.envand overwrites nothing.dev resetdrops and re-creates the app's database after asking.dev migrateapplies newerauthmigrations after an upgrade.
- Same as the server: the CLI provisions with the kit's
/provision, the same code the agent uses. Its Postgres image is the one pinned for the apps server, and a test keeps the two equal. - The app name comes from
--nameorpackage.json. Several apps share the one local Postgres, each with its own database, as on the server. - No Studio-style UI; any Postgres client works with the printed URL.
Consequences
- Local development needs Docker.
- Local data is throwaway (
dev reset). - The CLI's version must match the Spotcraft the app deploys to, like the kit's.