A sample project demonstrating AI applications using Firebase Cloud Run functions (2nd generation) and Genkit v1.8.0. This sample specifically utilizes the Genkit JS SDK. Genkit also offers SDKs for Go and Python, which are not covered in this particular project.
- Basic Genkit Flow Example (helloGenkitFlow)
- Image Analysis (Google AI)
- Web Content Analysis (Google AI)
- Chat Message Generation (Google AI & Firestore)
- Image Generation (Vertex AI)
- Google Maps Integration (via Genkit MCP)
- Genkit MCP Server Sample
firebase-genkit-sample/
├── .github/
│ └── workflows/ # CI/CD Pipelines sample
├── prompts/ # AI prompt templates
├── src/
│ ├── genkit-flows/ # AI flow implementations (e.g., analyzeImageFlow, helloGenkitFlow)
│ ├── mcp/
│ │ ├── client/ # MCP client implementations (e.g., mapsClient)
│ │ └── server/ # MCP server implementations (e.g., genkitMCP)
│ ├── tools/ # Custom Genkit tools (e.g., getCurrentTime, webLoader)
│ ├── genkit.ts # Genkit secrets/telemetry/logging configuration
│ └── index.ts # Firebase Functions deployment entry point
└── terraform/ # Terraform configuration for infrastructure setup (not directly related to Genkit, but used for setting up the overall Firebase project infrastructure)
- Install Genkit CLI
npm i -g genkit
- Install dependencies
npm install
- Set environment variables
export GCLOUD_PROJECT="your-google-cloud-project-id"
export GOOGLE_GENAI_API_KEY="your-api-key"
export GENKIT_ENV="dev"
export GOOGLE_MAPS_API_KEY="your-maps-api-key"
- Start Genkit emulator for development
npm start
- Deploy to Cloud Run functions (2nd generation)
firebase deploy --only functions
(Note: While this example focuses on Cloud Run functions for Firebase (2nd Gen), Genkit flows are highly portable. They can be deployed to various Node.js environments, including Google Cloud Run directly, or any other platform that supports Node.js execution.)
- Orchestrating Firebase and AI: 8 Genkit Architecture Patterns
- How to Develop Firebase Genkit Functions
- Getting Started with AI Image Generation Apps on Flutter, Genkit, and Imagen 3
- Extending Your AI Application with Genkit MCP
- Genkit vs Agent Development Kit (ADK): Choosing the Right Google‑Backed AI Framework