Skip to Content
Engineering11 Documentation 🔥

Admin API

Firebase Admin SDK wrapper with multi-project support and automatic initialization.

What It Does

The Admin API provides a singleton wrapper around the Firebase Admin SDK for Node.js applications. It automatically initializes Firebase services using environment variables and provides convenient access to all major Firebase Admin features including Firestore, Authentication, Cloud Storage, and Cloud Messaging.

Key Capabilities

CapabilityDescription
Automatic InitializationInitializes Firebase Admin SDK on import using environment credentials
Singleton PatternEnsures only one Firebase instance exists across the application
Multi-Project SupportManage multiple Firebase projects within a single process
Service AccessDirect access to Auth, Firestore, Storage, Messaging, Functions, and Realtime DB
Credential ManagementModels for loading and parsing Firebase/GCP service account credentials
Type SafetyFull TypeScript support with Firebase type definitions
Storage Bucket ManagementNamed bucket access with getBucket() utility
Multi-Database SupportAccess named Firestore databases with getDatabase()

Exports

Singleton Instances

  • app - The default Firebase App
  • firestore - Firestore database
  • storage - Cloud Storage bucket
  • auth - Firebase Authentication
  • messaging - Cloud Messaging
  • functions - Cloud Functions
  • apps - Array of all app instances
  • appNames - Friendly names of registered apps

Utility Functions

  • getBucket(name?) - Get storage bucket by name
  • getDatabase(name, app?) - Get named Firestore database

Classes

  • FirebaseAdminUtil - Firebase instance wrapper
  • FirebaseCredentialModel - Firebase credential model
  • GCPCredentialModel - GCP credential model

Re-exports

  • FirebaseError - Firebase error types
  • admin - Entire firebase-admin module

Common Use Cases

  • Multi-tenant SaaS: Manage separate Firebase projects for each tenant
  • Microservices: Shared Firebase initialization across services
  • Background jobs: Access Firebase services in Cloud Functions or Cloud Run jobs
  • Data migrations: Read/write data across multiple Firebase projects
  • Admin dashboards: Build admin tools that manage user accounts and data

Roadmap

Multi-Cloud Support

This API currently supports Google Cloud Platform. Future versions will add support for additional cloud providers and container-based deployment options, enabling greater flexibility in infrastructure choices.

What Customers Don’t Have to Build

  • Firebase Admin SDK initialization logic
  • Singleton pattern implementation
  • Environment variable parsing
  • Multi-project management infrastructure
  • Service accessor methods
  • Bucket selection utilities
  • Credential loading and validation
  • Database routing logic
  • Service instance lifecycle management
Last updated on