license: MITlang: TypeScriptmode: CLI

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.

users/{uid}
name
email
projects/
migrate
users
id
firebase_uid
name
email

-- how it works

Inspect first. Write last.

0001_connect

Connect

Provide Firebase Admin credentials securely.

0002_analyze

Analyze

Inspect Firestore and Firebase Auth without writing data.

0003_generate

Generate

Turn document patterns into a relational PostgreSQL schema.

0004_migrate

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.

example output
$ 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.

.env
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.

usage
npx @ezekielreu6/firemigrate <command>
01init [--force]

Creates firemigrate.config.json and .env.example with safe defaults. Never overwrites existing files unless you pass --force.

02inspect [--sample=<n>]

Read-only analysis of Firestore collections, field types, relationships and Firebase Auth. Samples up to n documents per collection (default 100).

03schema

Prints a reviewable PostgreSQL schema built from the inspection. Nothing is applied.

04migrate --dry-run

The default. Streams your documents and reports counts without writing to PostgreSQL. Firestore reads still apply.

05migrate --write

Applies the schema and upserts documents in batches. Also requires "dryRun": false in firemigrate.config.json.

06verify

Compares 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