CLI Reference
Every Unbase command and option.
unbase <command> [options]Commands
| Command | Description |
|---|---|
init | Write a starter unbase.config.ts. |
plan | Dry-run: show config, target readiness, snapshot, and the phase plan. |
extract | Pull DB + auth + storage into the IR snapshot (read-only). |
schema | Emit DDL or a Drizzle/Prisma schema (--orm); --apply runs DDL. |
storage | Upload mirrored objects to the storage target. |
rewrite | Rewrite Supabase storage URLs in the snapshot to the target. |
load | Load DB rows into the target Postgres (FK-safe), then verify. |
auth | Load users + accounts into Better Auth (preserves bcrypt). |
verify | Reconcile target row counts against the snapshot. |
Options
| Option | Applies to | Description |
|---|---|---|
--out <dir> | all | IR directory (default ./.unbase/ir). |
--schema <name> | extract, load, verify, auth | Postgres schema (default public). |
--project <name> | extract | Label for the snapshot manifest. |
--mirror | extract | Download storage object bytes (default: list only). |
--no-storage | extract | Skip storage entirely. |
--target <url> | load, verify, auth, schema | Target Postgres URL (overrides env). |
--source-host <h> | rewrite | Source storage host (else derived from env). |
--orm <kind> | schema | sql (default), drizzle, or prisma. |
--apply | schema | Run the DDL on the target instead of writing a file. |
--file <path> | schema | Output path (default <out>/schema.{sql,ts,prisma}). |
--create-schema | load | Create the target schema from the snapshot first. |
--to <target> | auth | better-auth (default) or authjs. |
--convert-images <fmt> | storage | Convert images: webp, avif, jpeg, png, keep. |
--convert-videos <fmt> | storage | Transcode videos: mp4, webm. |
--registry | storage | Create + populate the storage_object registry table. |
--image-quality <n> | storage | Encoder quality 1-100 (default 80). |
--max-width <n> / --max-height <n> | storage | Downscale images/videos to fit. |
A full run
npx unbase extract --mirror
npx unbase storage
npx unbase rewrite
npx unbase load
npx unbase authSee Configuration for the environment variables each command reads.