Firebase Functions supports Node.js. For Python or Go deployments see Cloud Run.
Prerequisites
- A Firebase project with Blaze (pay-as-you-go) billing enabled.
- Firebase CLI:
npm install -g firebase-tools - Node.js 20+
Project setup
1
Initialize Firebase
If you do not already have a Firebase project configured:Choose TypeScript when prompted. This creates a
functions/ directory with package.json, tsconfig.json, and src/index.ts.2
Install Genkit packages
3
Write your function
Edit
functions/src/index.ts:4
Configure environment variables
If you are using the Gemini API key model plugin, store the key in Firebase Secret Manager:Then reference the secret in your function configuration:
5
Deploy
Firebase telemetry
The@genkit-ai/firebase package provides enableFirebaseTelemetry, which routes traces, metrics, and structured logs to Google Cloud Observability (Cloud Trace, Cloud Monitoring, Cloud Logging) using the same pipeline as the @genkit-ai/google-cloud plugin.
Firestore vector search
The@genkit-ai/firebase package exports defineFirestoreRetriever, which wires a Genkit retriever to Firestore’s native vector-search feature (findNearest). Use it to build RAG flows that query documents stored in Firestore.
You must create a vector index on the embedding field in Firestore before nearest-neighbor queries will work. See the Firestore vector search documentation for index creation.
Durable streaming
For long-running flows, useFirestoreStreamManager (or RtdbStreamManager) so that clients can disconnect and reconnect without losing stream state:
firebase.json configuration
Next steps
Cloud Run
Deploy containerised Genkit apps with more control over the runtime.
Observability
Configure tracing and monitoring for production.
