慣性聚合 関心のあるブログ、ニュース、テクノロジーを効率的に追跡
原文を読む 慣性聚合で開く

おすすめ購読元

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
博客园 - 叶小钗
爱范儿
爱范儿
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队
T
Tailwind CSS Blog
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
小众软件
小众软件
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The part of shipping AI features nobody talks about — and...
Vishal Keert · 2026-05-24 · via DEV Community

There's a specific moment every developer hits when building an AI-powered app for the first time.

Not the fun part. Not the part where the model does something impressive and you feel like a genius. The other moment. The one at 1am where you're staring at your client code and you realize your Gemini API key is sitting right there, in plain text, about to be bundled into a JavaScript file that anyone with a browser and ten minutes can open and read.

That moment happened to me while building Sambhav — an AI career platform that did real-time voice transcription via Whisper, resume analysis, and personalized guidance through Gemini. The app had a Next.js 15 frontend talking to a Flask backend, Supabase underneath, and a lot of moving parts that all needed to touch an LLM at some point.

The feature I was most proud of: a real-time mock interview mode where users could speak naturally, get their responses transcribed, and have Gemini evaluate them on the fly. It felt polished. It worked well.

The architecture underneath it was a liability waiting to happen.


The actual problem

The pattern I'd fallen into was this: Gemini calls that needed low latency went client-side. Things like live transcription feedback, where adding a server round-trip would make the experience feel laggy and broken. But calling Gemini from the client meant the API key had to live somewhere the client could reach it.

The solutions developers usually reach for here are all bad in different ways.

You can put the key in an environment variable and hope your bundler doesn't leak it — it does, sometimes, and in ways that are hard to audit. You can proxy everything through your own backend — which works, but now you're maintaining session state across two services and your Flask server is doing nothing except forwarding requests and adding latency. You can use short-lived tokens — but then you're building a token generation and refresh system which is its own project.

The deeper issue is that none of these solve the quota problem. Even if you hide your API key, a motivated user can still capture a valid auth token in transit and replay it. Not to steal the key — just to drain your billing quota. For a personal project or a hackathon demo, that's an annoying edge case. For anything in production with real users, it's a real threat.

I ended up implementing the proxy approach because it was the most defensible, but it added meaningful latency to the interview feedback loop and made the session management significantly more complex. The Flask backend had to hold Whisper session state, Gemini context, and the authentication layer simultaneously. When something went wrong — and things go wrong in demos — it was never obvious which layer had failed.


What Firebase AI Logic actually changes

Secure AI Architecture

Firebase AI Logic isn't new — but what Google shipped at I/O makes it a materially different tool than it was six months ago, and the combination of two specific features addresses exactly the problem above.

The first is template-only mode. The architecture here is straightforward: your Gemini prompts — system instructions, model configuration, tool definitions — live on Firebase's servers, not in your client code. Your client references a template ID. That's it. When a request comes in, Firebase executes the server-side template. If someone intercepts the client request and tries to inject a custom system prompt, the framework ignores it. There's no path from client code to prompt manipulation.

For something like Sambhav's interview mode, this would've meant the evaluation rubric — the prompt that defines how Gemini scores a candidate's answer — lives on the server where it belongs, not bundled into the frontend. The client just sends the transcript and gets back a structured response.

The second is App Check replay protection with one-time tokens. Starting this month, App Check tokens for Firebase AI Logic are strictly single-use. A token that's been used once is dead. An attacker who captures a valid token in transit cannot replay it to make additional Gemini calls. The quota drain attack that I described earlier — the one that's technically possible even with a well-hidden API key — is now closed at the infrastructure level.

The latency tradeoff is real and worth acknowledging: generating a new token per request adds a network round trip. For a real-time transcription feature where you're making a Gemini call every few seconds, that cost adds up. This is worth profiling before enabling it on latency-sensitive paths.


The hybrid inference piece

Hybrid Inference Architecture

There's a third announcement that I think is underreported because it sounds like a performance optimization when it's actually an architectural decision.

Firebase now supports hybrid inference across iOS, Android (with Gemma 4), and — graduating to GA soon — Chrome on web. The model runs locally on the device when it can, falls back to cloud Gemini when it can't.

The reason this matters beyond "faster and cheaper" is resilience. Sambhav was built for hackathon conditions, which meant running on conference WiFi. Conference WiFi is hostile. The interview mode would occasionally stall mid-session because a Gemini call timed out, which killed the experience at exactly the moment someone was trying to demonstrate the product.

Hybrid inference means that the lightweight parts of the pipeline — transcription cleaning, basic response formatting, simple classification — can run locally regardless of network conditions. The heavier reasoning still goes to cloud. The app stays alive when the network doesn't.

The practical question for anyone implementing this: you don't get full Gemini quality from an on-device Gemma 4 model. The capability gap is real, and you need to design your feature so that the local path produces a graceful degraded experience rather than a broken one. This is a design problem, not just a configuration problem.


What this means practically

Firebase AI Logic GA isn't a headline announcement. It's not going to trend. But for any developer who has shipped or tried to ship an AI feature in a client application and hit the wall of "where does the API key live and how do I protect my quota" — this is the announcement that actually matters from I/O.

The combination of template-only mode, App Check replay protection, and hybrid inference means that the security and resilience architecture I cobbled together for Sambhav — proxy server, session state management, manual token handling — is now a first-class feature of the Firebase SDK. You don't have to build the plumbing. You configure it.

The thing I'd watch carefully going into production: template-only mode and replay protection solve different parts of the problem and have different latency profiles. Don't turn both on everywhere by default. Profile your latency-sensitive paths first, understand where the round-trip cost lands, and make deliberate decisions about where the tradeoffs are acceptable.

The security architecture that used to require a backend project now lives in three Firebase config options. That's a meaningful shift in what's practical to ship.