Firebase Services
import { ... } from "@95octane/common/firebase"
Wrappers around the Firebase Admin SDK, exposed as Effect services for dependency injection via Layers.
MyFirebase
Core Firebase initialization. Configures Firestore settings (SSL, cache) and provides access to all Firebase service instances.
- Emulator mode: Connects to
localhost:8080, SSL disabled - Production mode: SSL enabled, cache disabled
- Avoids duplicate initialization if app already exists
Provides: adminApp, auth, firestore, storage, messaging
MyFirebaseAuth
Firebase Authentication operations.
getUserByToken(idToken) — Verifies a Firebase ID token (checks for
revocation), then retrieves the associated UserRecord. Returns MyError with
code INVALID_TOKEN and status 401 on failure.
MyFirestore
Typed Firestore CRUD operations with automatic serialization.
| Method | Description |
|---|---|
getCollection<T>(caller, path, query?) |
Fetch collection with optional filtering |
getDocument<T>(caller, path) |
Fetch single document (404 if missing) |
setDocument<T>(caller, path, data) |
Create/update with merge semantics |
updateDocument<T>(caller, path, data) |
Update existing document fields |
deleteDocument(caller, path) |
Hard-delete a document |
documentExists(caller, path) |
Check if document exists |
Type conversions (handled automatically)
Date<-> FirestoreTimestampGeoPointobjects <-> FirestoreGeoPointDocumentReference<-> path string with metadata
MyMessaging
Firebase Cloud Messaging for push notifications.
sendNotification(options) — Sends a push notification with
platform-specific payloads for APNs (iOS) and Android. Options include token,
category, priority, data, and notification content.