Saltar al contenido
Logotipo de Aurabase
aurabase

Migrar desde Firebase

Guía paso a paso para mover los datos de Firestore, los usuarios de autenticación de Firebase y los depósitos a la infraestructura abierta y de alto rendimiento de Aurabase.

Guía práctica11 min leerNivel intermedio

La fuente en inglés ha cambiado desde esta traducción. Es posible que parte de la información esté desactualizada.
Esta página fue traducida automáticamente. La versión en inglés es autorizada.

Matching Firebase Bricks#

Aurabase replaces each proprietary Firebase component with standard, open, self-hosting technology without vendor lock-in:

FirebaseComparisonAurabase equivalent
Cloud FirestoreHigher equivalentPostgreSQL (relational and SQL) or Aurabase NoSQL (MongoDB-style)
Firebase AuthSame, enrichedSame OAuth support, plus TOTP MFA, magic links and passwords
Firebase StorageSame, enrichedS3-compatible REST API (SeaweedFS) with on-the-fly image transformations
Cloud FunctionsSameEdge Functions on standard Deno (Deno.serve()) and WASM
Security RulesSuperiorPostgres RLS (row-level security), evaluated in the database
Firebase Realtime DBSameAurabase Realtime (change data capture, presence and broadcast over NATS and WebSockets)

4-step roadmap#

  1. Schema & Data — Choice of model (PostgreSQL relational or NoSQL collections) and import (15 min)
  2. Authentication — Export Firebase Auth users and import scrypt/bcrypt hashes without reset (10 min)
  3. Storage files — Synchronization of Cloud Storage buckets to Aurabase Storage (variable depending on volume)
  4. SDK replacement — Replacing firebase/* with @aurabase/aurabase-js

From Firestore to Aurabase#

You can either normalize your data in PostgreSQL to take advantage of the power of SQL and strict typing, or import it directly into Aurabase's NoSQL Document Store engine:

Atención

Roadmap — not available. The aura commands shown below are planned and not delivered yet: the CLI does not have them today.

# 1. Export Firestore to JSONL file
npx firestore-export --serviceAccount credentials.json --output firestore-export.jsonl

# 2. Import into the Aurabase NoSQL engine
aura db nosql-import firestore-export.jsonl --collection users --project-id <id>

# 3. Generating complete TypeScript types
npx @aurabase/gen --out src/aurabase.types.ts

Frictionless user migration#

Atención

Roadmap — not available (Firebase hashes). aura auth import exists, but it accepts bcrypt and Argon2id hashes only (the Supabase path): Firebase's scrypt hashes and the --provider firebase option are planned and not delivered yet. Until then, create the users with the admin API (aura.authAdmin.createUser) and have them set a new password or sign in with a magic link.

The plan: keep Firebase's password hashes so that users keep their credentials without a password reset.

# Exporting users from Firebase CLI
firebase auth:export users.json --format=JSON --project my-firebase-app

# Planned: import into Aurabase Auth, keeping the scrypt hashes.
# Not available yet (`--provider` does not exist): see the notice above.
aura auth import users.json --provider firebase

Synchronizing S3 buckets#

Aurabase Storage uses a standard S3 API. You can sync your files continuously from Google Cloud Storage with the rclone or aws-cli utility:

# Direct transfer from GCS to Aurabase Storage
rclone sync gcs:my-firebase-bucket s3:aurabase-storage-bucket \
  --s3-endpoint https://api.aurabase.dev/v1/storage/$PROJECT_ID \
  --s3-access-key-id $AURABASE_SERVICE_ROLE_KEY \
  --progress

Replacing the Client SDK#

// BEFORE (Firebase)
import { getFirestore, doc, getDoc } from 'firebase/firestore'
const snap = await getDoc(doc(db, 'users', 'u1'))
const user = snap.data()

// AFTER (Aurabase)
import { createClient } from '@aurabase/aurabase-js'
const { data: user } = await aura.from('users').select('*').eq('id', 'u1').single()

To go further#

@aurabase/aurabase-js@0.7.5 · aura@0.3.4↗ Informar un problema