cd /news/ai-products/build-responsive-ai-powered-apps-wit… · home › topics › ai-products › article
[ARTICLE · art-163630] src=dev.to ↗ pub= topic=ai-products verified=true sentiment=↑ positive

Build Responsive, AI-powered Apps with Cloud Functions for Firebase: Web Architecture & Implementation Guide

The Firebase team released streaming responses for Cloud Functions callable functions and a new onCallGenkit trigger, letting server functions push data to clients in chunks as it becomes available and integrate Firebase Genkit generative AI workflows into production. A Google Developer Expert at CodingCat.dev detailed how the streaming API works, with servers checking the request's acceptsStreaming field and calling response.sendChunk per chunk while returning the full dataset for non-streaming clients. The post also covers Firebase AI Logic for invoking Gemini and Imagen models from client and edge apps without exposing API credentials, backed by App Check and centrally managed server-side prompt templates.

by read6 min views1 publishedNov 4, 2026

Original: https://codingcat.dev/post/firebase-2025-03-streaming-cloud-functions-genkit

Calling frontier multimodal models directly from a web or mobile client is a security minefield if you expose raw API keys or hardcode brittle system prompts in your frontend bundle. Following the announcement of Build Responsive, AI-powered Apps with Cloud Functions for Firebase by Daniel Lee, Jeff Huleatt on the Official Firebase Blog (2025-03-06), here is our hands-on CodingCat.dev breakdown of what actually shipped, how it works under the hood, and how we wire it into production TypeScript, Next.js, Astro, SvelteKit, React, and Angular applications. App users demand instant, dynamic app experiences, whether they’re chatting with an AI assistant, generating content in real time, or waiting for live data.

As a Google Developer Expert (GDE) for Firebase and Senior Solutions Architect at CodingCat.dev, I evaluate every Firebase update through one lens: does it reduce boilerplate while keeping our runtime security and cloud bills predictable? Firebase AI Logic lets you invoke Gemini and Imagen models from client and edge apps using the Firebase Web SDK while keeping your API credentials off the wire, enforcing Firebase App Check, and managing server-side prompt templates centrally.

AJ Pro-Tip from Alex: Combine Firebase AI Logic with server prompt templates, Firebase Remote Config feature flags, and project spend caps so you can iterate on prompts or swap Gemini models instantly without redeploying your Next.js or Astro frontend.

Since their introduction in 2017, Cloud Functions for Firebase’s callable functions have focused on providing you with a streamlined server(less) development experience that simplifies server-to-client interactions. Now, The Firebase team announced two new features that make it easier than ever to build responsive, AI-powered apps:

Streaming responses for callable functions, Deliver data incrementally to clients.

A new onCallGenkit trigger, Seamlessly integrate Firebase Genkit to productionize generative AI workflows.

**Note: **In this post, we show how to stream data from a Node.js callable function to a client web app that’s using the Firebase JS SDK. We’re also working on bringing this to the Python functions SDK, as well as our Swift, Kotlin, and Dart client SDKs.

Traditionally, when a client application calls a server function, it has to wait for the entire response to be generated before it can do anything. This “all-or-nothing” approach works well for many scenarios, but it falls short when dealing with:

Why do generative AI APIs return their responses token-by-token?

With the new streaming capability for Callable Functions, your server can send data to the client in chunks, as it becomes available. The client can then process and display this data incrementally, creating a much more responsive and engaging user experience.

Imagine Firebase is building a web app for weather enthusiasts or frequent travelers that want to see the forecast for lots of locations at once, and that it calls a callable function to get these forecasts. Without streaming, they’d have to sit and wait while the forecast for each location is fetched, and can only start browsing the results once every location’s forecast is fetched and returned from the server.

With streaming, our weather enthusiasts can start viewing each location’s data as soon as it’s ready:

To stream results, check the acceptsStreaming field of the request object, and call response.sendChunk every time you have a chunk of data that’s ready to send back to the client. Return the full dataset at the end for clients that don’t accept streaming.

exports
    const

    const
        const

        // Stream each forecast as it resolves!
        if
            response.
        }

        return
    });

    // Fallback for non-streaming clients
    return
});

Use the Firebase client SDKs to consume the streaming response from a web app:

const
const
for
  updateUI
}
const

If you’re already using callable functions in your app, adding streaming behavior may just be a small change to your server and client code that results in big user-experience benefits!

For generative AI applications, The Firebase team built a new onCallGenkit trigger on top of this new streaming functionality.

Firebase Genkit is an all-in-one toolkit to prototype, test, build, and monitor production-ready generative AI applications. The new onCallGenkit trigger now lets you deploy Genkit flows as secure, scalable APIs with one line:

// An example Genkit flow.
const
    {
        name: 
        // ...
    },
    async
        const
            `
        );
        for
            sendChunk
        }
        return
    },
);

// Deploy the flow with Cloud Functions for Firebase
exports

As above, use the functions SDK to consume the results from a client app:

const
const
for
  updateUI
}
const

With onCallGenkit, you leverage all features we offer in Cloud Functions for Firebase, like:

**Simplified Deployment: **Deploy your Genkit flows with just the firebase deploy command you are familiar with.

**Automatic Streaming: **onCallGenkit automatically handles the streaming setup for you. Just use sendChunk() within your Genkit flow, and call the stream method from the client SDK.

**Built-in Abuse Prevention: **Protect your AI-powered function with Firebase App Check.

**Secret Management: **Securely store and access API keys and other sensitive information with enterprise-grade Cloud Secret Manager.

**Concurrency: **Benefit from Cloud Function for Firebase 2nd gen features like concurrency to scale your service efficiently. With concurrency, one function instance can handle multiple concurrent requests, a great fit for AI applications that depend heavily on API calls.

Here’s a more robust sample based on the code above:

const
    {
        name: 
        inputSchema: z.
        outputSchema: z.
        streamSchema: z.
    },
    async
        const
            `
        );
        for
            sendChunk
        }
        return
    },
);

// Deploy to Firebase with secrets and App Check
const
exports
    {
        secrets: [geminiApiKey],
        enforceAppCheck: 
    },
    jokeTeller,
);

These new features are ready to use now with the 2nd gen Node.js runtime, but we’re still working on Python support. You can follow along as we implement it!

We’re still working on updating our Swift, Kotlin, and Dart client SDKs so that native mobile apps can also use this streaming functionality, alongside web apps. Until then, your functions can fall back to non-streaming behavior for these clients.

Whether we are deploying on Firebase App Hosting, Cloudflare Workers, or Vercel, shipping AI features to production requires defense-in-depth across three layers:

Accelerate your full-stack web and AI development by pairing Build Responsive, AI-powered Apps with Cloud Functions for Firebase with strict Security Rules, Firebase App Check, and local emulator testing. Come tell us on X (@CodingCatDev) and ** LinkedIn (CodingCat.dev)** how you are using Firebase in your stack, and subscribe to the ** CodingCat.dev YouTube Channel** so you don't miss what we build next!

Want to see how we architect and debug Firebase web applications live? Watch our related CodingCat.dev session Firebase Security Rules: Effortless control over your app's data. below, and make sure to ** Subscribe to CodingCat.dev on YouTube** for weekly full-stack web and AI deep dives:

Build Responsive, AI-powered Apps with Cloud Functions for Firebase (announced 2025-03-06 by the Firebase team) enhances the platform for Firebase, Google Cloud, Web Dev, AI, TypeScript, Security, Serverless workloads. App users demand instant, dynamic app experiences, whether they’re chatting with an AI assistant, generating content in real time, or waiting for live data. Developers can review the primary announcement on the Firebase Blog alongside our implementation patterns and production checklist above.

Web developers can integrate these features using the modular Firebase JavaScript/TypeScript SDK, Firebase Data Connect web bindings, and Firebase App Hosting. Always pair client-side SDK initialization with Firebase App Check and strict Security Rules, and test locally with the Firebase Local Emulator Suite before deploying.

You can watch our hands-on Firebase video walkthroughs on the CodingCat.dev YouTube Channel, including ** Firebase Security Rules: Effortless control over your app's data.**, and follow us on ** X (@CodingCatDev)** for weekly full-stack tutorials.

── more in #ai-products 4 stories · sorted by recency
── more on @firebase 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/build-responsive-ai-…] indexed:0 read:6min 2026-11-04 · —