Repository navigation
cmd migrate firebase
Generate nSelf migration artifacts from a Firebase Firestore and Auth export.
nself migrate firebase --export-dir <path> [flags]
nself migrate firebase converts a Firebase Firestore JSON export into the migration artifacts needed to run the same data on nSelf: a migration.sql schema file, a hasura-metadata.yaml file, an optional auth-import.sql for migrating Auth users, and a MIGRATION_SUMMARY.md guide.
No live Firebase connection is required. The command operates entirely on locally exported JSON files, so it is safe to run in air-gapped or CI environments.
The migration process does not apply any changes to your nSelf project automatically. All generated files are written to the output directory for review before you apply them.
- Export your Firestore data:
firebase firestore:export --format json ./firebase-export
- Optionally export your Auth users:
firebase auth:export --format json ./firebase-export/auth-users.json
- Run the migration command:
nself migrate firebase --export-dir ./firebase-export
- Review the generated files in
<export-dir>/nself-migration/. - Apply the schema and metadata to your nSelf project.
With NSELF_V15=1 the command (also nself db import firebase) imports the live project instead of
writing artifacts: Firestore through the REST API, users from an auth:export file, objects from
Cloud Storage. It loads into a started nSelf project and verifies every count. See Come-Home-Firebase.
nself db import firebase --project my-project --credentials-file ./key.json --auth-export ./auth-users.json --plan| Flag | Default | Description |
|---|---|---|
--export-dir |
— | Directory produced by firebase firestore:export. Required in v1.4 mode.
|
--auth-export |
"" |
Path to Firebase Auth JSON export (optional) |
--output-dir |
<export-dir>/nself-migration |
Directory for generated artifacts |
--project-name |
firebase_import |
Project name used in generated SQL schema names and file prefixes |
--project |
"" |
v1.5 import: Firebase project id |
--credentials-file |
"" |
v1.5 import: service-account key file (not needed with FIRESTORE_EMULATOR_HOST) |
--bucket |
"" |
v1.5 import: Cloud Storage bucket to copy |
--plan |
false |
v1.5 import: check the source and target, write nothing |
--keep-stage |
false |
v1.5 import: keep the private portable bundle after a pass |
--skip-storage |
false |
v1.5 import: list each storage object as an exemption instead of loading it |
--json |
false |
v1.5 import: print the structured import report |
| File | Contents |
|---|---|
migration.sql |
CREATE TABLE statements with RLS scaffolding for each inferred collection |
hasura-metadata.yaml |
Hasura table tracking and permissions scaffold |
auth-import.sql |
INSERT statements for Auth users (only when --auth-export is provided) |
MIGRATION_SUMMARY.md |
Step-by-step guide for applying the artifacts to nSelf |
# Basic: export dir only
nself migrate firebase --export-dir ./firebase-export
# With Auth users
nself migrate firebase \
--export-dir ./firebase-export \
--auth-export ./firebase-export/auth-users.json
# Custom output directory and project name
nself migrate firebase \
--export-dir ./firebase-export \
--output-dir ./nself-migration \
--project-name myappAfter reviewing the generated files:
# Apply the schema SQL to your nSelf Postgres instance
nself db migrate apply --file ./nself-migration/migration.sql
# Import Hasura metadata (via Hasura console or CLI)
hasura metadata apply --directory ./nself-migration/hasura-metadata.yaml
# Import auth users (if generated)
nself exec psql < ./nself-migration/auth-import.sqlSee MIGRATION_SUMMARY.md in the output directory for the full step-by-step instructions specific to your export.
- Collection naming follows Firestore conventions. Nested sub-collections become separate tables with a
_parent_idforeign key. - Firestore types are mapped to Postgres types on a best-effort basis. Review
migration.sqlbefore applying. - Firestore Security Rules are not converted. Apply your Hasura row-level security policies manually.
- cmd-migrate — v0.9 to v1 project migration
- cmd-migrate-supabase — migrate from Supabase
- cmd-db — run schema migrations on a live project
Getting Started
Commands
- Commands, Overview
- Lifecycle: cmd-init · cmd-build · cmd-start · cmd-stop · cmd-restart · cmd-dev
- Monitoring: cmd-status · cmd-logs · cmd-health · cmd-urls · cmd-doctor · cmd-monitor · cmd-alerts · cmd-sentry · cmd-watchdog
- Data: cmd-db · cmd-backup · cmd-dr · cmd-queue · cmd-webhooks
- Config: cmd-config · cmd-service · cmd-env · cmd-promote
- Networking: cmd-ssl · cmd-trust · cmd-dns-setup
- Security: cmd-access · cmd-security · cmd-secrets
- Tenancy: cmd-tenant · cmd-billing
- Plugins: cmd-plugin · cmd-license · cmd-dogfood (extracted, CLI-R11) · cmd-k8s (extracted, CLI-R11) · cmd-encryption (extracted, CLI-R11) · cmd-waf (extracted, CLI-R11) · cmd-federation (extracted, CLI-R11) · cmd-mail (extracted, CLI-R11) · cmd-dlq (extracted, CLI-R11)
- AI: cmd-ai · cmd-claw · cmd-model
- Templates: cmd-template
- Utilities: cmd-exec · cmd-clean · cmd-reset · cmd-update · cmd-upgrade · cmd-version · cmd-admin · cmd-migrate · cmd-migrate-firebase · cmd-migrate-supabase · cmd-completion
Features
- Features, Overview
- Feature-Auth
- Feature-Storage
- Feature-Search
- Feature-Functions
- Feature-Email
- Feature-Monitoring
- Feature-Plugins
- Feature-nClaw, AI Assistant
- Feature-nChat, Messaging
- Feature-nFamily, Family Social
- Feature-nCloud, Managed Hosting
- Feature-Memory-Rooms, Knowledge Organization
- Feature-Agent-Dashboard, Agent Metrics
- Feature-Image-Generation, AI Image Generation
Configuration
- Configuration, Overview
- Config-Env-Vars
- Config-Postgres
- Config-Hasura
- Config-Auth
- Config-Nginx
- Shared-Proxy
- Config-Optional-Services
- Config-Custom-Services
- Config-System
Plugins (87 + 10 monitoring)
- Plugin-Overview
- Plugin-Catalog
- Plugin-Install
- Plugin-Licensing
- Plugin-Architecture
- Plugin-Dev-Guide
- Plugin-Migrations-Contract
Free (25)
- plugin-backup
- plugin-content-acquisition
- plugin-content-progress
- plugin-cron
- plugin-donorbox
- plugin-feature-flags
- plugin-github
- plugin-github-runner
- plugin-invitations
- plugin-jobs
- plugin-link-preview
- plugin-mdns
- plugin-mlflow
- plugin-monitoring
- plugin-notifications
- plugin-notify
- plugin-paypal
- plugin-search
- plugin-shopify
- plugin-stripe
- plugin-subtitle-manager
- plugin-tokens
- plugin-torrent-manager
- plugin-vpn
- plugin-webhooks
Pro (62)
- plugin-access-controls
- plugin-activity-feed
- plugin-admin-api
- plugin-analytics
- plugin-auth
- plugin-bots
- plugin-browser
- plugin-calendar
- plugin-cdn
- plugin-chat
- plugin-claw
- plugin-claw-budget
- plugin-claw-news
- plugin-claw-web
- plugin-cloudflare
- plugin-cms
- plugin-compliance
- plugin-ddns
- plugin-devices
- plugin-documents
- plugin-entitlements
- plugin-file-processing
- plugin-game-metadata
- plugin-geocoding
- plugin-geolocation
- plugin-google
- plugin-home
- plugin-idme
- plugin-knowledge-base
- plugin-linkedin
- plugin-livekit
- plugin-media-processing
- plugin-meetings
- plugin-moderation
- plugin-mux
- plugin-object-storage
- plugin-observability
- plugin-photos
- plugin-podcast
- plugin-post
- plugin-realtime
- plugin-retro-gaming
- plugin-rom-discovery
- plugin-social
- plugin-sports
- plugin-support
- plugin-tmdb
- plugin-voice
- plugin-web3
- plugin-workflows
Planned (26)
plugin-auditplugin-blogplugin-checkoutplugin-commerceplugin-drmplugin-exportplugin-flowplugin-importplugin-ldapplugin-mailgunplugin-mediaplugin-oauth-providersplugin-pagesplugin-postmarkplugin-rate-limitplugin-reportsplugin-samlplugin-schedulerplugin-sendgridplugin-ssoplugin-subscriptionplugin-thumbplugin-transcoderplugin-twilioplugin-wafplugin-watermark
Guides
- Guide-Production-Deployment
- Guide-SSL-Setup
- Guide-Multi-Tenancy
- Guide-Security-Hardening
- Guide-Monitoring-Setup
- Guide-Backup-Restore
- Guide-Custom-Services
- Guide-Migration-from-v1
Architecture
- Architecture
- Architecture-Guardrails
- Service-Graph
- Compose-Generation
- Nginx-Generation
- Plugin-Architecture
Reference
Machine interface
-
JSON-Output,
--jsonenvelope -
Command-Registry,
nself help --json - Exit-Codes
- error-codes, Error Codes
-
Compat-V15,
NSELF_V15gate
Licensing
Security
Brand
Operations
- operations/release-cascade, Release Cascade
- operations/self-healing, Self-Healing Schema
- operations/redis-tuning, Redis Pool Tuning
- operations/meilisearch-warmup, MeiliSearch Warm-Up
- operations/jwt-rotation, JWT Key Rotation
- operations/windows-wsl2-setup, Windows / WSL2 Setup
- operations/gemini-oauth-reauth, Gemini OAuth Reauth
Contributing
Admin
- USER-ACTION-QUEUE, Pending Admin Actions
All commands (21)
- A: cmd-add · cmd-admin
- B: cmd-backup · cmd-build
- C: cmd-clean · cmd-config
- D: cmd-db · cmd-deploy · cmd-doctor
- E: cmd-exec
- I: cmd-init
- L: cmd-license · cmd-logs
- M: cmd-mcp
- R: cmd-remove · cmd-reset · cmd-restart
- S: cmd-start · cmd-status · cmd-stop
- U: cmd-update