Inspiration
Exam prep (UPSC/IFoS-style MCQ drills) is exactly the kind of routine that gets broken by patchy connectivity. AI quiz generators exist, but they all assume you are online. This project asks: what if the drill generator lived on your device, and only reached for the cloud when it was worth it?
What it does
DrillForge Hybrid is an offline-first web app that turns any topic into a timed MCQ drill:
- On-device generation: when the Chrome built-in Gemini Nano engine is available, questions are generated locally through the Prompt API, with zero network use.
- Cloud fallback via Firebase AI Logic: when the device engine is unavailable, the same generate() call routes to Gemini through the Firebase AI Logic SDK, so the drill never stalls.
- Offline queue: if both engines are unreachable (airplane mode, bad hostel wifi), topics are queued in local storage and auto-generate on reconnect.
- Spaced repetition: every miss is explained and re-queued; wrong answers reappear in the next drill.
- Installable PWA: a service worker caches the app shell, so the app opens and runs with no network at all.
How we built it
A plain HTML/JS PWA (no framework, so it loads fast on 2G). The hybrid router tries the on-device LanguageModel session first, falls back to Firebase AI Logic cloud inference, and parks the topic in the offline queue if both fail. The service worker (cache-first) keeps the shell and assets available offline.
Challenges
Handling the engine-availability matrix honestly: Chrome builds without the built-in model, no-network situations, and partial answers. The router treats every failure as a queueable state instead of an error, and the UI always says which path (on-device or cloud) produced the questions.
What we learned
That hybrid inference is a UX feature, not a plumbing detail: users do not care where the questions come from, they care that the drill starts instantly, offline or not.
Built With
- chrome-built-in-ai-prompt-api
- css
- firebase
- firebase-ai-logic
- gemini-nano
- html
- javascript
- pwa
- service-worker