npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@genkit-ai/firebase

v1.40.1

Published

Genkit AI framework plugin for Firebase including Firestore trace/state store and deployment helpers for Cloud Functions for Firebase.

Readme

Firebase plugin for Genkit

The Firebase plugin integrates Genkit with Firebase and Google Cloud. It provides:

  • Telemetry / Monitoring - export traces, metrics, and logs to Google Cloud / Firebase for Genkit monitoring.
  • Durable Streaming (Beta) - persist flow stream state in Firestore or the Realtime Database so streams can be resumed.
  • Session Store (Beta) - persist agent session snapshots in Firestore, sharded and scalable to arbitrarily long sessions.

See also the official docs for deploying Genkit with Firebase.

Installing the plugin

npm i --save @genkit-ai/firebase

Telemetry / Monitoring

Call enableFirebaseTelemetry() to export Genkit traces, metrics, and logs to Google Cloud / Firebase:

import { genkit } from 'genkit';
import { enableFirebaseTelemetry } from '@genkit-ai/firebase';

enableFirebaseTelemetry();

const ai = genkit({
  plugins: [
    // ...
  ],
});

See the monitoring documentation for details.

Durable Streaming (Beta)

This plugin provides two StreamManager implementations for durable streaming:

  • FirestoreStreamManager: Persists stream state in Google Firestore.
  • RtdbStreamManager: Persists stream state in the Firebase Realtime Database.

You can use these with expressHandler or appRoute to make your flow streams durable.

Usage

To use a stream manager, import it from @genkit-ai/firebase/beta and provide it to your flow handler:

import { expressHandler } from '@genkit-ai/express';
import { FirestoreStreamManager } from '@genkit-ai/firebase/beta';
import express from 'express';
import { initializeApp } from 'firebase-admin/app';
import { getFirestore } from 'firebase-admin/firestore';

// ... define your flow: myFlow

const fApp = initializeApp();
const firestore = new FirestoreStreamManager({
  firebaseApp: fApp,
  db: getFirestore(fApp),
  collection: 'streams',
});

const app = express();
app.use(express.json());

app.post('/myDurableFlow', expressHandler(myFlow, { streamManager: firestore }));

app.listen(8080);

Similarly, for the Realtime Database:

import { RtdbStreamManager } from '@genkit-ai/firebase/beta';

const rtdb = new RtdbStreamManager({
  firebaseApp: fApp,
  refPrefix: 'streams',
});

app.post('/myDurableRtdbFlow', expressHandler(myFlow, { streamManager: rtdb }));

Limitations

  • Firestore: The entire stream history (chunks and final result) is stored in a single document. Firestore has a strict 1MB limitation on document size. If your stream output exceeds this limit, the flow will fail.
  • Realtime Database: While RTDB does not have the same 1MB limit, storing very large streams may impact performance or hit other quotas.

Session Store (Beta)

FirestoreSessionStore is a Firestore-backed SessionStore for persisting agent session snapshots. It is a thin Firebase wrapper around the core implementation in @genkit-ai/google-cloud, adding a firebaseApp option for deriving the Firestore instance from a Firebase app. Unlike a naive single-document store, it persists each turn as an incremental JSON Patch diff anchored to periodic, sharded full-state checkpoints, so:

  • No single document approaches Firestore's 1 MiB limit (state is sharded across documents).
  • The number of documents read/written per turn is bounded by checkpointInterval rather than total session length, so it scales to arbitrarily long sessions (e.g. long-lived chatbots, coding agents).
  • Reconstruction uses only document-ID lookups inside a read-only transaction, so it needs no secondary indexes and is strongly consistent.

Usage

Import it from @genkit-ai/firebase/beta and pass it as the store when defining an agent:

import { genkit } from 'genkit/beta';
import { FirestoreSessionStore } from '@genkit-ai/firebase/beta';
import { initializeApp } from 'firebase-admin/app';

const fApp = initializeApp();

const ai = genkit({
  plugins: [
    // ...
  ],
});

const myAgent = ai.defineAgent({
  name: 'myAgent',
  model: 'googleai/gemini-2.5-flash',
  system: 'You are a helpful assistant.',
  store: new FirestoreSessionStore({ firebaseApp: fApp }),
});

Options

FirestoreSessionStore accepts the following options:

  • firebaseApp: A Firebase app to derive the Firestore instance from.
  • db: An explicit Firestore instance. Takes precedence over firebaseApp.
  • collection: The collection where snapshot documents are stored. Defaults to "genkit-sessions". Two companion collections are derived from it: "<collection>-pointers" (one pointer document per session) and "<collection>-shards" (the sharded checkpoint state).
  • checkpointInterval: Number of turns between full-state checkpoints. Defaults to 25. Lower it (e.g. 10) for small-state, read-heavy sessions; raise it (e.g. 50-100) for large per-turn state retained for a long time.
  • shardSize: Maximum size in bytes of a single shard / diff document. Defaults to 512 KiB. Any diff exceeding this is promoted to a sharded checkpoint so no document approaches the 1 MiB limit.

The sources for this package are in the main Genkit repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Genkit documentation.

License: Apache 2.0