Get Started
Next

Database

Supabase + SQL workflow used by the kit.

Postgres Supabase Database

Every project is a full Postgres database, the world's most trusted relational database.

  • 100% portable
  • Built-in Auth with RLS
  • Easy to extend
  • Easy to extend

What It Does

The kit uses Supabase/PostgreSQL with SQL-first schemas, generated app schemas, and generated migration bundles.

When To Use

  • Adding or modifying tables/policies/functions.
  • Regenerating migrations after setup changes.
  • Running local database workflows.

Prerequisites

  • Docker Desktop running locally.
  • Supabase CLI installed.

How To Use

Core directories

PathPurpose
supabase/schemasHand-written core kit SQL sources
supabase/app-schemasHand-written core app SQL sources
supabase/migrationsGenerated merged migration file using creatorem generate-sql
supabase/testsSQL tests
000-privileges.sql
001-enums.sql
...more-schema-files.sql
2026xxxxxxxx_generated_from_schemas.sql
config.toml
seed.sql

Standard flow

pnpm run supabase:start
creatorem generate-sql
pnpm run db:reset
pnpm run db:types

Command details

  • creatorem generate-sql: reads app setup (.creatorem/setup.json), generates supabase/app-schemas/*, then assembles the merged migration file in supabase/migrations/*.
  • pnpm run db:reset: resets the local Supabase database, applies the generated SQL migration state, and rebuilds the local database from that SQL source.
  • pnpm run db:types: run this after db:reset with the Supabase Docker instance running; it generates TypeScript DB types from the current database state and refreshes Drizzle schema artifacts.

Reset local database

pnpm run db:reset

MCP Context

capability: database_workflow entrypoints: - supabase/schemas/ - supabase/app-schemas/ - supabase/migrations/ - creatorem generate-sql - package.json scripts (db:reset, db:types) inputs: - sql_sources - setup_json outputs: - generated_migration_sql - updated_local_database - refreshed_types constraints: - generated migration file should not be edited manually - ordering in supabase/schemas affects merge output side_effects: - writes SQL files - mutates local db state

Agent Recipe

  1. Edit SQL sources or setup definitions.
  2. Start local Supabase (pnpm run supabase:start) and keep it running.
  3. Run creatorem generate-sql.
  4. Run pnpm run db:reset.
  5. Run pnpm run db:types.

Troubleshooting

  • If migration output is empty, verify SQL files exist in supabase/schemas and/or generated app schemas.
  • If runtime queries fail after schema updates, regenerate types with pnpm run db:types.

How is this guide?

Last updated on 3/23/2026