Simulacrum

Database overview

Adapter pattern, switching stacks, migrations, and how Simulacrum ships Prisma, Drizzle, Supabase, and raw PostgreSQL in one project.

Mental model

Simulacrum generates a DatabaseAdapter interface that your app uses for users, CRUD, aggregates, and occasional raw SQL. Swapping adapters means updating simulacrum.config.ts and running the correct migration command, not rewriting every route.

Supported adapters

| Adapter | When to use | | --- | --- | | Supabase | RLS-first apps, hosted Postgres with auth-adjacent tooling | | Drizzle | TypeScript schemas, serverless-friendly drivers | | Prisma | Mature migrations, Studio workflows | | PostgreSQL (postgres.js) | Thin queries with an escape hatch for raw SQL | | SQLite | Demos, portfolio free tier, local-only flows |

MySQL via Prisma is available where the generated schema targets MySQL; see Prisma for dialect notes.

Configuration

In simulacrum.config.ts:

  • database.adapter — active implementation
  • Connection URLs and pool hints per environment

Migrations per adapter

| Adapter | Typical command | | --- | --- | | Supabase | supabase db push or linked migration flow | | Drizzle | npx drizzle-kit push or migrate | | Prisma | npx prisma migrate dev | | Postgres | Apply generated SQL with your runner |

Always snapshot production before running migrations. Generated SQL is a starting point; review constraints and indexes for your workload.