Inspiration

Personal finance assistants face a fundamental trade-off: cloud LLMs provide deep financial analysis, yet users hesitate to upload raw receipts, merchant names, and sensitive spending notes to external servers. We built DG Nexus AI (Hybrid Edition) to eliminate that compromise using Firebase AI Logic hybrid inference—keeping raw financial data strictly on the user's device while leveraging cloud AI only for anonymized, high-level insights.

What it does

DG Nexus AI is a privacy-first personal finance command terminal and wallet powered by hybrid AI routing:

  • On-Device Execution (ONLY_ON_DEVICE / PREFER_ON_DEVICE via Gemini Nano):
    • /add <receipt or note>: Extracts amounts, merchants, and categories locally in Chrome without raw text ever leaving the browser.
    • /audit: Runs a local privacy audit over the user's transaction history.
  • Cloud Execution (ONLY_IN_CLOUD via Firebase AI Logic & Gemini 2.5 Flash):
    • /analyze, /simulate, and /anomalies: Compute deep performance insights, budget simulations, and anomaly detection using only aggregated category totals—stripping merchant names, raw notes, and high-sensitivity records before egress.
  • Full Transparency & Offline Resilience:
    • Every response displays a live execution badge (⚡ On-Device: Gemini Nano vs. ☁ Cloud: Firebase AI Logic).
    • A real-time Hybrid Routing & Cloud Egress Log proves exactly what payload (if any) leaves the device.
    • A Privacy Mode toggle masks wallet balances and enforces strict on-device routing, backed by Cloud Firestore offline persistence so private receipt parsing continues working even without internet access.

How we built it

  • Frontend & Core: Vanilla TypeScript and Vite (firebase SDK v12.5+), featuring a responsive dark-mode financial dashboard, interactive terminal, and service worker caching.
  • Hybrid AI Layer (src/ai/hybrid.ts, src/ai/router.ts, src/ai/tasks.ts): Uses Firebase AI Logic (InferenceMode, initializeDeviceModel, inferenceSource, and inCloudParams) to dynamically route tasks between Chrome's built-in Gemini Nano and Gemini 2.5 Flash.
  • Security & Backend: Protected with Firebase App Check, Anonymous Authentication, user-scoped Firestore Security Rules, and hosted globally on Firebase Hosting.

Challenges we ran into

  • Ensuring zero accidental data leakage required designing a strict payload sanitizer before invoking ONLY_IN_CLOUD tasks, paired with a live UI egress log so judges and users can verify the exact JSON sent to the cloud.
  • Coordinating initialization order across Firebase Auth, App Check debug tokens, and Firestore offline listeners required careful state management so the UI works seamlessly both online and offline.

Accomplishments that we're proud of

  • End-to-end hybrid inference running live on Firebase Hosting (https://nexus-ai-hybrid.web.app) with verifiable on-device vs. cloud routing badges.
  • True offline capability: disconnecting the network still allows /add and /audit to parse receipts locally with Gemini Nano and persist them to Firestore's local cache.

What we learned

Combining Firebase AI Logic's hybrid routing with strict client-side data minimization turns privacy from a policy promise into an observable, verifiable architecture.

What's next

  • Adding OCR image receipt scanning processed locally via multimodal on-device models.
  • Expanding multi-currency budgeting rules and automated recurring-bill anomaly alerts.

Built With

  • cloud-firestore
  • firebase
  • firebase-ai-logic
  • firebase-app-check
  • firebase-hosting
  • gemini-2.5-flash
  • gemini-nano
  • html5
  • pwa
  • typescript
  • vite
Share this project:

Updates

Submission history