@ichibase/cli
v0.1.0
Published
ichibase migration CLI — extract Supabase / Postgres / MongoDB / Atlas into an ichibase migration bundle and push it to your project.
Downloads
169
Readme
@ichibase/cli
The ichibase CLI. Today it ships the migration commands — extract an
existing app from Supabase / Postgres / MongoDB / Atlas into an ichibase
migration bundle and push it to your project. (The broader local-dev surface —
init / db push / functions deploy — is still future work.)
Extraction runs entirely on your machine against your source. Your source credentials never leave your computer; only the resulting migration bundle is uploaded to your ichibase project.
Install
npm i -g @ichibase/cli # or: npx @ichibase/cli …For MongoDB/Atlas sources you also need the
MongoDB Database Tools
(mongodump) on your PATH.
1. Extract a bundle
# Supabase (tables + data + auth users; bcrypt passwords come across)
# Use the SESSION POOLER string (Settings → Database → Connection string → Session pooler);
# the direct db.<ref>.supabase.co host is IPv6-only and won't resolve on most machines.
ichibase migrate supabase --conn "postgresql://postgres.<ref>:PASSWORD@aws-0-<region>.pooler.supabase.com:5432/postgres" --out ./bundle
# Generic Postgres (schema + data)
ichibase migrate postgres --conn "postgresql://user:pw@host:5432/dbname" --out ./bundle
# MongoDB / Atlas (collections + documents)
ichibase migrate mongodb --conn "mongodb://user:pw@host:27017" --db myapp --out ./bundle
ichibase migrate atlas --conn "mongodb+srv://user:[email protected]" --db myapp --out ./bundleThis writes an ichibase migration bundle to ./bundle:
manifest.json source kind, row counts, (mongo) source db name
schema.json Postgres: tables, columns, PK, uniques, indexes, FKs
data/<table>.ndjson Postgres rows (one JSON object per line)
data/mongo.archive Mongo: native mongodump --archive --gzip
auth.ndjson users (Supabase): id, email, password_hash, oauth links2. Push it to your project
ichibase migrate push --project <slug> --bundle ./bundle \
--api https://api.ichibase.com --token "$ICHIBASE_TOKEN"--token is your ichibase owner token / API key (or set ICHIBASE_TOKEN).
The CLI uploads each bundle part to storage via presigned URLs, starts the
import, and streams progress until it completes. The final report lists row /
document counts and any manual follow-ups.
Notes & limitations (v1)
- Same-paradigm only: Supabase/Postgres → Postgres, MongoDB/Atlas → MongoDB. Cross-paradigm (SQL→Mongo, Firestore) is coming later.
- Passwords: imported users keep working — ichibase verifies the source hash (bcrypt) on first login and transparently upgrades it to Argon2id. Users whose hash can't be verified must use "forgot password".
- User IDs are preserved, so your data's foreign keys to
auth.usersstay valid. - RLS: imported tables have Row-Level Security enabled with no policies — only your service key can read them until you add policies (Dashboard → Database → RLS). Source policies are reported, not auto-translated.
- Paid plans only.
- Integers larger than 2^53 should be stored as strings in the source to avoid
JSON precision loss; standard
bigintids within that range are fine.
