Skip to content

nozomi-koborinai/firebase-genkit-sample

Repository files navigation

firebase-genkit-sample

A sample project demonstrating AI applications using Firebase Cloud Run functions (2nd generation) and Genkit.

🚀 Features

  • Image Analysis (Google AI)
  • Web Content Analysis (Google AI)
  • Chat Message Generation (Google AI & Firestore)
  • Image Generation (Vertex AI)

📁 Project Structure

firebase-genkit-sample/
├── .github/
│ └── workflows/          # CI/CD Pipelines sample
├── prompts/              # AI prompt templates
├── src/
│ ├── genkit-functions/   # AI function implementations
│ ├── genkit.ts           # Genkit configuration
│ └── index.ts            # Deploy Functions
└── terraform/            # Terraform configuration for infrastructure setup (not directly related to Genkit, but used for setting up the overall Firebase project infrastructure)

🛠 Quick Start

  1. Install Genkit CLI
npm i -g genkit
  1. Install dependencies
npm install
  1. Set environment variables
export GCLOUD_PROJECT="your-google-cloud-project-id"
export GOOGLE_GENAI_API_KEY="your-api-key"
export GENKIT_ENV="dev"
  1. Start Genkit emulator for development
genkit start -- npx tsx --watch src/index.ts
or
genkit start -- firebase emulators:start --inspect-functions
  1. Deploy to Cloud Run functions (2nd generation)
firebase deploy --only functions

📚 Articles

English

Japanese