Back to Blog
Tutorial8 min read2026-07-17

Deploy a Firebase Genkit AI App on PandaStack (2026)

Genkit is Google's open-source framework for building AI features with flows, structured output, and observability. It's just a Node server underneath — here's how to containerize a Genkit app and deploy it on PandaStack.

Ajay Kumar
Ajay Kumar
Founder & DevOps, PandaStack

Genkit (https://genkit.dev) is Google's open-source framework for building AI-powered features — flows, tool calling, structured output via schemas, and built-in tracing so you can actually see what your model did. Google naturally nudges you toward deploying it on their infrastructure, and that's a fine path. But Genkit is an open framework that produces a plain Node server, so it runs anywhere Node runs. I run PandaStack; here's how to containerize a Genkit app and ship it here, keeping the door open to whatever model provider you like.

A Genkit flow

Genkit's core unit is a flow — a typed, traceable function that wraps your AI logic:

// src/index.ts
import { genkit, z } from 'genkit'
import { googleAI } from '@genkit-ai/googleai'
import express from 'express'

const ai = genkit({
  plugins: [googleAI()], // swap the plugin for your provider of choice
})

const summarize = ai.defineFlow(
  {
    name: 'summarize',
    inputSchema: z.object({ text: z.string() }),
    outputSchema: z.object({ summary: z.string(), wordCount: z.number() }),
  },
  async ({ text }) => {
    const { output } = await ai.generate({
      model: googleAI.model('gemini-2.5-flash'),
      prompt: `Summarize in under 50 words:\n\n${text}`,
      output: { schema: z.object({ summary: z.string(), wordCount: z.number() }) },
    })
    return output!
  },
)

const app = express()
app.use(express.json())
app.post('/summarize', async (req, res) => {
  res.json(await summarize(req.body))
})
app.get('/health', (_req, res) => res.json({ ok: true }))
app.listen(process.env.PORT || 8080)

The outputSchema is doing real work: Genkit coerces the model's output into your Zod schema, so downstream code gets typed data, not a string you have to parse and pray over. The provider plugin is swappable — Google AI here, but Genkit supports others, so you're not locked in.

Step 1: Build to JS

{
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  }
}
npm run build && npm start   # confirm /summarize responds

Step 2: Dockerfile

FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json tsconfig.json ./
RUN npm ci
COPY src ./src
RUN npm run build

FROM node:20-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=build /app/dist ./dist
EXPOSE 8080
CMD ["node", "dist/index.js"]

Step 3: Deploy on PandaStack

  1. 1Push to Git.
  2. 2https://dashboard.pandastack.io → New App → connect the repo. PandaStack builds the Dockerfile with rootless BuildKit and deploys.
  3. 3Set your model provider credentials as encrypted environment variables — a GEMINI_API_KEY (or GOOGLE_GENAI_API_KEY), or point Genkit at a self-hosted/LiteLLM endpoint. These never touch the repo or the build logs.
  4. 4Every push redeploys. Add a custom domain under Domains for automatic SSL.

CLI:

npm install -g @pandastack/cli
panda login
panda deploy

Step 4: Persist what the flow produces

Most AI features need to store results — generated summaries, embeddings, chat history. Attach a managed database:

  • Postgres for structured records and, with pgvector, embeddings.
  • Redis for caching identical prompts so you don't pay to summarize the same document twice.

Attach it in the dashboard and read DATABASE_URL from the environment inside your flow. Caching repeat prompts in Redis is the single cheapest win for an AI endpoint — do it early.

Step 5: Observability

Genkit's built-in tracing shows you each generation, its inputs, and its latency — invaluable when a flow misbehaves. In production, pair Genkit's traces with PandaStack's live app logs and metrics so you can correlate a bad response with what the container was doing. Add an alert (Email/Slack/Webhook) on error-rate spikes so a provider outage or a prompt regression pings you instead of silently degrading.

Honest tradeoffs

  • Deploying to Google's stack is the smoothest path if you're all-in on their ecosystem (Firebase, Cloud Functions). Self-host on PandaStack when you want provider flexibility, everything under one roof, or to avoid a second platform.
  • AI endpoints cost money per call. Cache aggressively, cap request sizes, and monitor spend — a framework detail, not a hosting one, but it'll bite regardless of host.
  • Free-tier apps scale to zero and cold-start; keep an interactive AI endpoint warm on a paid tier.
  • Genkit is evolving quickly — pin versions and check the docs on upgrade.

Wrap-up

Genkit gives you typed, traceable AI flows; underneath it's just a Node server. Containerize it, deploy on PandaStack, keep your provider key in the encrypted env store, attach Postgres/Redis for persistence and caching, and wire up alerts. Google's stack is a fine alternative — this is the portable path.

Docs: https://docs.pandastack.io. Start free: https://dashboard.pandastack.io.

Ready to deploy?

Start free on PandaStack.

Start free on PandaStack

More in Tutorial

Browse all Tutorial articles →

See also