Move your Firebase data to PostgreSQL, on purpose.
FireMigrate reads your Firestore and Firebase Auth data, proposes a relational schema, and migrates it deliberately — nothing gets written until you say so.
-- how it works
Inspect first. Write last.
Connect
Provide Firebase Admin credentials securely.
Analyze
Inspect Firestore and Firebase Auth without writing data.
Generate
Turn document patterns into a relational PostgreSQL schema.
Migrate & verify
Move data deliberately, then compare source and destination.
-- schema mapping
Relational by default. Honest about uncertainty.
FireMigrate analyzes collections, field types, timestamps, maps, arrays, and references — and tries to preserve real relationships instead of dumping every document into a JSON column.
$ npx @ezekielreu6/firemigrate inspect
✓ Firebase credentials validated
✓ Firestore discovered
✓ 14 top-level collections found
✓ 182,491 documents counted
✓ Firebase Auth discovered
⚠ 3 collections contain inconsistent field types
⚠ 2 relationships require manual review
Ready to generate a PostgreSQL schema.Example output with illustrative numbers. Your run prints the real counts and warnings for your own project.
-- safety
Confidence before convenience.
Credentials stay server-side. Writes stay explicit. Warnings stay visible. The default workflow is built for review before production.
- Dry runs and schema preview
- Non-destructive defaults
- Detailed migration warnings
- Read-only verification
- Provider-aware Auth analysis
- No credential exposure
-- get started
Your migration starts with a read-only inspection.
Configure Firebase Admin credentials and a PostgreSQL connection. Never commit service-account keys or print them in logs.
FIREBASE_PROJECT_ID=
FIREBASE_CLIENT_EMAIL=
FIREBASE_PRIVATE_KEY=
DATABASE_URL=DATABASE_URL is only needed for migrate and verify. Environment variables override firemigrate.config.json.
-- commands
One clear command at a time.
Run any command with npx, no install needed.
npx @ezekielreu6/firemigrate <command>init [--force]Creates firemigrate.config.json and .env.example with safe defaults. Never overwrites existing files unless you pass --force.
inspect [--sample=<n>]Read-only analysis of Firestore collections, field types, relationships and Firebase Auth. Samples up to n documents per collection (default 100).
schemaPrints a reviewable PostgreSQL schema built from the inspection. Nothing is applied.
migrate --dry-runThe default. Streams your documents and reports counts without writing to PostgreSQL. Firestore reads still apply.
migrate --writeApplies the schema and upserts documents in batches. Also requires "dryRun": false in firemigrate.config.json.
verifyCompares PostgreSQL row counts with your Firestore collections and exits non-zero on any mismatch.
-- built in the open
A foundation you can inspect and improve.
FireMigrate is MIT-licensed and built for contributors: improve analyzers, add safer mappings, report edge cases, and help make Firebase migrations less mysterious.
Read the contribution guide