Firebase Emulators
Connecting to local Firebase Emulators for development.
Usage
Refirebase automatically connects to the Firebase Local Emulator Suite if you set the useEmulators flag to true. You don't need to manually import or configure the connection methods.
.env
// .env.local
FIREBASE_USE_EMULATORS=true
FIREBASE_PROJECT_ID=demo-projectfirebase.ts
import { Refirebase } from 'refirebase';
// Just pass useEmulators: true in the config object
// OR rely on the FIREBASE_USE_EMULATORS env var.
const firebase = new Refirebase({
useEmulators: true
});
// Emulators automatically bind to standard ports:
// Firestore: 8080
// Auth: 9099
// Realtime DB: 9000
// Storage: 9199Default Ports
Refirebase expects the emulators to be running on their default ports. Ensure your firebase.json matches these values:
| Emulator | Default Host:Port |
|---|---|
| Firestore | http://localhost:8080 |
| Auth | http://localhost:9099 |
| Realtime DB | http://localhost:9000 |
| Storage | http://localhost:9199 |