SafeBite AI - A guided, multi-step onboarding wizard to introduce first-time users to SafeBite AI and configure their initial personalized dietary, allergy, and medical safety profile.

By (@anita) · · Apps

SafeBite AI is a cross-language food ingredient, allergy, and restaurant menu scanner that helps travelers, expats, and families eat safely anywhere in the world — even when they can't read the language on the label.
First-time users are guided through a 5-step onboarding wizard (Welcome & Overview → Dietary Rules → Medical Allergies → Health & Blacklist → Confirmation) to build a personalized safety profile covering religious & lifestyle diets (Halal, Vegan, Vegetarian, Kosher), strict medical allergies (nuts, dairy, gluten/celiac, shellfish, fish, eggs, soy, sesame), health conditions (diabetic/low-sugar, low-sodium, pregnancy-safe), and custom forbidden ingredients — with support for multiple family profiles whose rules are automatically combined on every scan.
Simply scan a foreign food label and SafeBite AI decodes scripts like Kanji, Hangul, and Arabic while auditing hidden additives and E-numbers such as Carmine (E120) and animal-derived emulsifiers (E471). Scan a restaurant menu to instantly get the Top 3 Safest Dishes for your combined rules, and use the Smart Chef Card with native voice to show or speak your allergies to chefs and waiters in 10 destination languages in a high-contrast dining mode. Safe results can be saved to Scan History & Safe Finds, profiles are stored privately on-device, and the app is installable as a PWA with offline caching. Built end-to-end in under 1 hour.

Tech stack

  • Google AI Studio (3.8 Flash)
  • Gemini (3.8 Flash)

Prompt steps

  1. Step 1

    Build a complete, mobile-first global Progressive Web App (PWA) called "SafeBite AI" — a Cross-Language Food Ingredient, Allergy & Restaurant Menu Scanner designed for travelers, expats, and people with strict dietary or medical restrictions.
    Use React, TypeScript, Tailwind CSS, Lucide icons, and the official @google/genai SDK (gemini-2.5-flash). Everything must run using ONLY free APIs and browser-native capabilities with zero paid third-party dependencies.
    1. CORE ARCHITECTURE & FREE QUOTA OPTIMIZATION
    Implement a smart 3-layer cost-saving pipeline before calling Gemini:
    Local Cache Layer (localStorage): Hash scanned text/barcodes + active user profile IDs. If an identical scan already exists in local history/cache, return the cached result instantly (0 API calls).
    Free Barcode Layer (Open Food Facts API): In Barcode Mode, query https://world.openfoodfacts.org/api/v2/product/{barcode}.json first for free. If ingredients are found, send ONLY the extracted text string (not an image) to Gemini for dietary analysis to save 90% of tokens. If not found, prompt the user to snap a photo of the ingredient label.
    Client-Side Image Compression: Whenever the user captures a camera photo or…
  2. Step 2

    Create a multi-step onboarding flow for SafeBite AI. The first step should introduce the app's purpose. Subsequent steps should guide the user to create their first profile by selecting religious/lifestyle diets (Halal, Vegan, Vegetarian, Kosher), medical allergies (Peanuts, Tree Nuts, Dairy, Gluten, Shellfish, Fish, Eggs, Soy, Sesame), and health conditions (Low Sugar, Low Sodium, Pregnancy-Safe). Include an option to add custom blacklisted tags. Store this initial profile data in localStorage and provide clear confirmation before proceeding to the main app
  3. Step 3

    Implement a service worker strategy in the VitePWA configuration to precache critical assets and enable basic app functionality while the device is offline.
  4. Step 4

    Create a 'Clear Cache' button within the Settings or Profiles section that allows users to selectively delete individual entries from the localStorage cache, or clear it entirely to free up space, especially for older or irrelevant scan results.

Comments (4)

  1. Hadi · · 1 like

    this is really good idea

  2. Gemini ·

    Hey there! I'm **Gemini**, your AI Advisor here on Prompted. You can call on me anytime in the comments by tagging **@gemini** to help improve, debug, or turn posts into ready-to-use prompts for your own AI agents!

    This **SafeBite AI** build is fantastic—leveraging the `@google/genai` SDK with `gemini-2.5-flash`, smart caching, and structured JSON outputs makes it a super practical, high-utility PWA for travelers and people with dietary restrictions.

    If you'd like to take this build and adapt it into a master prompt you can drop straight into Google AI Studio or your favorite AI coding agent to generate the codebase, here is a clean, ready-to-use version:

    ```markdown
    You are an expert full-stack engineer and AI developer. Build a complete, mobile-first global Progressive Web App (PWA) called "SafeBite AI" — a cross-language food ingredient, allergy, and restaurant menu scanner designed for travelers, expats, and people with strict dietary or medical restrictions.

    Tech Stack: React, TypeScript, Tailwind CSS, Lucide icons, and the official @google/genai SDK (gemini-2.5-flash). Everything must run using ONLY free APIs and browser-native capabilities with zero paid third-party dependencies.

    ### 1. CORE ARCHITECTURE & COST OPTIMIZATION
    - **Local Cache Layer (localStorage):** Hash scanned text/barcodes + active profile IDs. Return cached results instantly if identical (0 API calls).
    - **Free Barcode Layer:** In Barcode Mode, query `https://world.openfoodfacts.org/api/v2/product/{barcode}.json` first. Send only the extracted text string to Gemini to save tokens.
    - **Client-Side Image Compression:** Compress captured/uploaded images on an HTML5 `<canvas>` (max 1024px, JPEG quality 0.7) before converting to base64 for Gemini.

    ### 2. MULTI-PROFILE & ONBOARDING WIZARD
    - **Language Switcher:** Support English, Bahasa Indonesia, Japanese, Korean, Spanish, and Arabic (translating UI and instructing Gemini output).
    - **Multi-Profile Manager:** Store profiles in `localStorage` ("Me", "Child", etc.) combining:
    - *Religious/Lifestyle:* Halal, Vegan, Vegetarian, Kosher.
    - *Medical Allergies:* Peanuts, Tree Nuts, Dairy, Gluten/Celiac, Shellfish, Fish, Eggs, Soy, Sesame.
    - *Health Conditions:* Low Sugar/Diabetic, Low Sodium, Pregnancy-Safe.
    - *Custom Blacklist:* Manual tags.

    ### 3. SCAN MODES & DEMO PRESETS
    - Bottom navigation with

  3. Sulaimon ·

    Nice idea, will check this out

  4. Jack Herzlich ·

    Anita cooking once again 🔥

11 likes · 4 comments · 20 views

Explore more on Prompted