BiteSpy is a Next.js 16 app that helps users scan a food product, answer a short question flow, and view a truth-style report with alternatives. The UI is built for a friendly, guided experience, while the backend is split across services:
- Firebase Auth handles signup and login.
- MongoDB Atlas stores auth mirror records.
- Firestore stores the profile form data.
The current demo flow is hardcoded around a Nutella-style product journey so the frontend can be tested end-to-end without the MCP backend being connected yet.
- User signs up or logs in with Firebase Auth.
- Signup/login success syncs an auth record into MongoDB Atlas.
- User uploads a product image on the home page.
- The app routes to a 5-question yes/no flow.
- After the questions, a loader screen appears briefly.
- The result page shows the Truth-o-Meter, nutrients, alerts, and ingredient reality.
- The alternatives page shows healthier, cheaper, and same-taste options.
- Next.js 16 App Router
- React 19
- TypeScript
- Firebase Auth
- Firestore for profile data
- MongoDB Atlas for auth sync
- Tailwind CSS for styling
- Framer Motion and icon libraries for interaction
- package.json - project scripts and dependencies.
- next.config.ts - Next.js configuration.
- tsconfig.json - TypeScript configuration and path aliases.
- eslint.config.mjs - linting rules.
- postcss.config.mjs - Tailwind/PostCSS setup.
- .env - local environment variables for Firebase and MongoDB Atlas.
- firebase.ts - Firebase client initialization for Auth.
- app/page.tsx - landing page that combines the navbar, hero, upload area, and footer.
- app/signup/page.tsx - Firebase signup form.
- app/login/page.tsx - Firebase login form.
- app/profile-form/page.tsx - profile form that saves profile details.
- app/profile/page.tsx - view/edit profile screen.
- app/questions/page.tsx - 5-step yes/no product questions.
- app/processing/page.tsx - loader page shown between questions and results.
- app/result/page.tsx - final truth report page.
- app/alternatives/page.tsx - alternative products page.
- app/news/page.tsx - news page.
- app/insights/page.tsx - insights page.
- app/api/auth/sync/route.ts - syncs Firebase auth users into MongoDB Atlas.
- app/api/profile/route.ts - profile CRUD endpoint backed by Firestore.
- components/Navbar.tsx - top navigation with dynamic login/logout state.
- components/Hero.tsx - landing hero section.
- components/ClaimForm.tsx - upload card that starts the question flow.
- components/Upload.tsx - upload-related UI component.
- components/Footer.tsx - site footer.
- components/Logo.tsx - shared BiteSpy logo.
- lib/profile.ts - shared profile types, validation, and email normalization.
- lib/mongodb.ts - MongoDB Atlas connection helper.
- lib/firebase-admin.ts - Firebase Admin setup for Firestore profile access.
Set these in .env:
NEXT_PUBLIC_FIREBASE_API_KEYNEXT_PUBLIC_FIREBASE_AUTH_DOMAINNEXT_PUBLIC_FIREBASE_PROJECT_IDNEXT_PUBLIC_FIREBASE_STORAGE_BUCKETNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_IDNEXT_PUBLIC_FIREBASE_APP_IDNEXT_PUBLIC_FIREBASE_MEASUREMENT_IDFIREBASE_PROJECT_IDFIREBASE_CLIENT_EMAILFIREBASE_PRIVATE_KEYMONGODB_URIMONGODB_DB_NAMEGEMINI_API_KEYARMORIQ_API_KEYARMORIQ_USER_ID(orUSER_ID)ARMORIQ_AGENT_ID(orAGENT_ID)ARMORIQ_MCP_SERVER_NAME(single deployed MCP server registered in ArmorIQ)ARMORIQ_PROXY_ENDPOINT(optional)ARMORIQ_STRICT_MODE(optional, settrueto fail instead of falling back to direct Gemini)
npm install
npm run devThen open http://localhost:3000.
npm run build- Firebase Auth remains the source of truth for sign-in and sign-up.
- MongoDB Atlas stores a lightweight auth mirror in
auth_users. - Firestore stores the profile form data used by the profile pages.
- The profile question/result flow is frontend-only for now and hardcoded for the Nutella demo case.
- AI execution now supports ArmorIQ SDK with one MCP server and multiple tools.
scan-agentandanalyze-agentare enforced with separate policy allow/deny sets in lib/armoriq-policy.ts.- Business logic in scan/analyze routes remains unchanged; only execution transport changed.
- If ArmorIQ env vars are missing, backend falls back to direct Gemini unless
ARMORIQ_STRICT_MODE=true.
If you reconnect a real backend later, the best places to start are:
- app/api/auth/sync/route.ts for auth metadata.
- app/api/profile/route.ts for profile persistence.
- app/questions/page.tsx and app/result/page.tsx for the product analysis flow.
This app builds cleanly with npm run build and is ready for Netlify or another Next.js host once the environment variables are set.