2. Generate Database Types

Purpose: Regenerate TypeScript types from the live Supabase schema after any migration that adds, removes, or modifies table columns.

Prerequisites:

  • SUPABASE_PROJECT_ID set in .env.local (or pass --project-id flag)
  • SUPABASE_ACCESS_TOKEN for remote generation

Cost / Duration: $0 | 1-2 min

Prompt

Regenerate TypeScript types from the Supabase schema.

Step 1 — Generate types:

```bash
bun run db:types
```

Pulls the current schema from Supabase and writes TypeScript types to
the DB package.

Step 2 — Review the generated changes:

```bash
git diff packages/db/
```

Verify new tables appear and modified columns are reflected.

Step 3 — Verify types are current:

```bash
bun run db:types --check
```

Expected: Exit code 0 — types are current.

Verification

  • bun run db:types completes without errors
  • git diff packages/db/ shows expected type changes
  • bun run db:types --check passes (exit code 0)
  • No TypeScript compilation errors after regeneration

Back to index