Unbase

Configuration

Environment variables and storage provider settings.

Unbase reads configuration from environment variables (e.g. a .env in your working directory). Secrets stay on your machine — nothing is sent anywhere.

Source (Supabase)

VariableRequiredDescription
SUPABASE_DB_URLyesDirect or pooler Postgres connection string.
SUPABASE_SERVICE_KEYfor storageservice_role key (reads private buckets).
SUPABASE_URLoptionalProject URL; derived from the DB URL if omitted.

Target database

VariableDescription
TARGET_DB_URL / NEON_DB_URLTarget Postgres (load / verify / auth).

Target storage

Unbase uses one S3 client for every provider, configured with provider-neutral STORAGE_* names (the legacy CLOUDFLARE_R2_* / NEXT_PUBLIC_R2_URL names are still accepted):

VariableDescription
STORAGE_ACCESS_KEY_IDAccess key.
STORAGE_SECRET_ACCESS_KEYSecret key.
STORAGE_BUCKETTarget bucket.
STORAGE_ACCOUNT_IDR2 account id (derives the R2 endpoint).
STORAGE_ENDPOINTExplicit endpoint (GCS / MinIO / custom S3).
STORAGE_REGIONRegion (AWS S3).
STORAGE_FORCE_PATH_STYLE"true" for MinIO and other path-style hosts.
STORAGE_PUBLIC_URLPublic base URL objects are served from (used by rewrite).

Per provider

  • Cloudflare R2 — set STORAGE_ACCOUNT_ID (endpoint is derived).
  • AWS S3 — set STORAGE_REGION (e.g. us-east-1).
  • Google Cloud Storage — STORAGE_ENDPOINT=https://storage.googleapis.com with HMAC keys.
  • MinIO — set STORAGE_ENDPOINT and STORAGE_FORCE_PATH_STYLE="true".

Config file

Run unbase init to scaffold an unbase.config.ts describing what to migrate (secrets stay in .env). It seeds command defaults — CLI flags still override.

unbase.config.ts
/** @type {import("@unbase/core").UnbaseConfig} */
const config = {
  schema: "public",
  database: true,
  createSchema: true,   // build the target schema before load
  auth: true,
  storage: { enabled: true, mirror: true, provider: "r2", keepBucketPrefix: true },
};
export default config;

Then preview everything with a dry run:

npx unbase plan

plan is read-only — it reports config, which env vars are set/missing per target, the snapshot summary, and the exact phases that would run.

Snapshot location

The IR defaults to ./.unbase/ir. Override per command with --out <dir>, or point the TUI at one with UNBASE_IR=<dir>.

On this page