Inspiration
56% of America's adults have at least one diet-related chronic condition diabetes, heart disease, hypertension. Every one of them still grocery shops the same way everyone else does: staring at 40,000 SKUs with zero guidance on what's actually good for their body, their family, this week. We kept asking one question: why does every grocery platform treat a family with a diabetic father, a kid with a peanut allergy, and a visiting grandma with celiac disease the same as a household of healthy 25-year-olds?
Your grocery store should know your family. Not just what you bought last time what you need this time. And that need changes every single week. Someone gets a cold. A relative visits with food restrictions. It's BBQ weekend. The store should adapt.
That's HealthCart a grocery store where every product knows your family's health, and the entire shopping experience reshapes itself based on one natural conversation about your week.
What it does
HealthCart is a grocery shopping platform where families describe their week in plain language "My mom Linda is visiting, she can't have gluten. Jake has a summer cold. We're doing a BBQ on Saturday and it's going to be really hot." and the entire store transforms.
Products re-sort by health relevance. Vitamin C-rich bell peppers and citrus rise for Jake's cold recovery. Gluten-containing products get flagged for Linda. High-fiber, low-glycemic items surface for Mike's pre-diabetes and cholesterol. Every product has a health badge recommended, limit, or avoid personalized to THIS family THIS week.
A complete grocery basket is designed automatically. Not a ranked list of "healthy foods" an optimized basket with calculated quantities based on family size, USDA nutritional gaps, shelf life, and budget. Coverage score shows: "This basket covers 87% of your family's weekly nutritional needs Mike: 82%, Jake: 91%, Linda: 78%." Change a quantity and coverage updates in real time.
Safety is absolute. Peanut products are hard-blocked from Jake's basket not scored low, blocked entirely. Gluten products cannot enter Linda's basket. These aren't suggestions they're enforced constraints that no amount of preference can override.
The AI never picks the groceries. Gemini parses natural language and writes friendly responses. Every product ranking, every safety block, every basket decision is made by a deterministic intelligence pipeline with full traceability graph paths, score breakdowns, constraint audits visible in the UI.
How we built it
The core principle: deterministic intelligence, not LLM opinions. We built a multi-layer pipeline where Gemini is the ears and the mouth, but never the brain:
Clinical Knowledge Graph (Postgres) ~50 nodes and 114 edges encoding health condition → nutritional requirement relationships. condition:diabetes → REQUIRES → tag:low_glycemic. condition:celiac → AVOID → tag:contains_gluten. BFS traversal up to depth 3 produces required tags, avoid tags, preferred tags, and nutrient axis weights for each household's combined conditions.
USDA Nutrition Pipeline 300,000+ foods from USDA FoodData Central mapped to products. Each product gets auto-generated dietary tags from nutritional thresholds (iron-rich, high-fiber, low-glycemic, contains-peanuts). ~98% of products mapped to FoodOn ontology terms. The graph says what tags matter; product tags say what each SKU is.
Hard Safety Filter Before any scoring: allergens are blocked (peanut allergy → any product with contains_peanuts gets score 0, badge avoid, cannot enter basket). Vegetarian constraints enforced. Graph avoid tags enforced. Nutrient caps enforced (sodium/sugar/GI limits for specific conditions). This layer is not a suggestion — it's a wall.
Hybrid Scoring Engine
Sfinal=0.45×Snutrient+0.30×Sgraph+0.15×Ssemantic+0.10×SseasonalS_{final} = 0.45 \times S_{nutrient} + 0.30 \times S_{graph} + 0.15 \times S_{semantic} + 0.10 \times S_{seasonal}Sfinal=0.45×Snutrient+0.30×Sgraph+0.15×Ssemantic+0.10×Sseasonal
Nutrient cosine (45%): cosine similarity between product's nutrition vector (% of weekly RDA per nutrient) and the household's ideal nutrition vector derived from member ages, conditions, and graph axis weights Graph match (30%): proportion of clinically required/preferred tags the product satisfies Semantic intent (15%): maps weekly context (cold → hydrating + vitamin C, BBQ → grilled proteins) to tag matching Seasonal boost (10%): in-season products score higher
- Basket CSP Optimizer
Constraint satisfaction over the scored products: pick top N per category, compute quantities from household size + nutrient gaps + shelf life, run a fairness pass ensuring every member gets coverage, trim to budget if set, then re-audit the final basket through the safety filter. Every item carries its full explanation: graph path, score breakdown, constraints checked.
- Gemini (parsing + formatting only)
The intent agent calls Gemini to extract structured JSON from natural language — who's visiting, who's sick, what mood, what budget. If confidence is below 0.6, it asks a clarification question instead of guessing. The formatter agent receives the already-audited basket and writes a 3-5 sentence response using only allowed product names. If no API key is available, rule-based extraction and template formatting work as offline fallbacks. Stack: Next.js 14 (App Router, TypeScript), Aurora PostgreSQL (Prisma), Google Gemini Flash, deployed on Vercel. 51 tests (golden, smoke, integration) passing at ship.
Challenges we ran into
Making the LLM NOT the decision-maker was the hardest design challenge. Every tutorial, every example app puts the LLM at the center — "ask GPT what to recommend." We had to deliberately architect around that instinct. The LLM wants to be helpful and pick groceries. We had to constrain it to only parsing and formatting, and prove that a deterministic pipeline produces better, safer, more explainable results. The knowledge graph had to encode real clinical nutrition, not vibes. "Diabetes → avoid sugar" is oversimplified to the point of being wrong. We had to research actual nutritional relationships — glycemic load vs glycemic index, the difference between soluble and insoluble fiber for cholesterol, iron bioavailability differences between heme and non-heme sources, nutrient absorption interactions (vitamin C enhances iron, calcium blocks it). Getting this right required reading actual USDA Dietary Guidelines and AHA publications, not just prompting an LLM. Allergen safety is non-negotiable. A recommendation engine that "usually" avoids peanuts for someone with a peanut allergy is dangerous. We built the hard filter as a separate, auditable layer that runs before scoring AND after basket assembly. No product that triggers an allergen or condition-avoid rule can ever reach the user, regardless of how high its nutritional score might be. Hybrid scoring weights required real tuning. Our first attempt weighted all four components equally the results felt random. We iterated to 45/30/15/10 (nutrient/graph/semantic/seasonal) through testing against the Johnson demo family across multiple weekly contexts. The nutrient cosine similarity needed to dominate because that's the measurable, objective component.
Accomplishments that we're proud of
Full traceability. Every badge, every basket item, every blocked product has an explanation the user can inspect. "Show evidence" reveals the graph path, the score breakdown, the constraints checked. No black boxes. If HealthCart says "avoid this product for Jake," you can see exactly why which allergy, which graph edge, which safety rule. The store actually transforms. This isn't a health overlay on a static store. Type "Jake has a cold" and watch products re-sort in real time. Hydrating foods and vitamin C sources rise. Heavy, hard-to-digest items drop. The coverage score recalculates. It's the same catalog, but a completely different shopping experience every week, based on what's happening in your family's life. Safety-first architecture. The hard filter is not a scoring penalty it's a binary gate. Allergens are blocked, not deprioritized. This is the right engineering decision for a product that families with food allergies would actually trust. 51 tests shipping to production. Golden tests for scoring, smoke tests for API routes, integration tests for the full chat → score → basket pipeline. The intelligence layer has a v1 fallback path (INTELLIGENCE_V2=false) that's still in production code as a safety net.
What we learned
LLMs are terrible decision-makers but incredible translators. Gemini is phenomenal at understanding "mi mamá está visitando, no puede comer gluten" and extracting {visitor: mom, condition: celiac}. It's unreliable at deciding whether Product #47 is appropriate for a celiac diabetic household. The right architecture uses LLMs for what they're great at (language) and deterministic systems for what they're great at (consistent, auditable decisions). Nutrition is a graph problem, not a tagging problem. Our v1 was tag-matching: "diabetes → boost low_glycemic." v2 with the knowledge graph captures second-order relationships: diabetes REQUIRES low_glycemic AND high_fiber, high_fiber SYNERGIZES_WITH whole_grains, whole_grains PROVIDES magnesium, magnesium SUPPORTS insulin_sensitivity. BFS traversal discovers these paths automatically we don't have to hardcode every chain. Coverage score changes behavior. When users see "removing kale drops Jake's iron coverage from 91% to 74%," they keep the kale. A ranked list says "kale is good for you" — a coverage score says "here's what happens to your son's nutrition if you skip it." Quantified impact is more persuasive than qualitative advice.
What's next for Healthcart
WhatsApp-native grocery assistant. The same intelligence engine, but you never open a website. Save HealthCart's number on WhatsApp. Text it like you'd text a family member: "Mom's visiting this week, she can't have gluten. Jake has a cold. It's going to be really hot want something light. Oh and we need more olive oil." HealthCart responds with your personalized weekly basket, scored and optimized, right in the chat. Tap to adjust quantities, tap to confirm, groceries show up at your door. The entire grocery shopping experience happens inside a conversation you're already having. No app to download. No website to browse. Just WhatsApp the way 2 billion people already communicate. WhatsApp's 2026 policy explicitly permits purpose-specific AI services like grocery assistance, product recommendations, and order management HealthCart fits cleanly within these guidelines as a structured, service-focused assistant, not a general-purpose chatbot. pgvector semantic scoring. The current semantic component (15% of hybrid score) uses intent-to-tag matching. With Aurora's vector extension, we'd generate nutrition-aware embeddings for every product and replace tag matching with true semantic similarity understanding that "something warming for a cold" matches ginger, turmeric, and bone broth without explicit tag mapping. Expanded knowledge graph. Import the full FoodOn ontology and USDA/FoodOn crosswalk for richer nutritional reasoning. Add drug-food interactions statins and grapefruit, blood thinners and vitamin K-rich greens so a family managing medications alongside diet gets real safety from their grocery store. Multi-market deployment. The engine is market-agnostic. Swap USDA data for India's IFCT (Indian Food Composition Tables) and the same pipeline serves Indian families shopping for ragi flour and palak instead of quinoa and kale. We're planning an India launch targeting Hyderabad with ICMR dietary guidelines and regional language support in Hindi and Telugu.
Built With
- amazon-aurora-postgresql
- css
- google-gemini-flash
- html
- next.js
- node.js
- prisma
- react
- tailwind-css
- typescript
- usda-fooddata-central
- vercel
Log in or sign up for Devpost to join the conversation.