Public
Remixed
Track meals & digestion to find ingredient triggers
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

πŸ«ƒ Gut Tracker

Track what you eat and how your digestion responds β€” over time, identify which ingredients are correlated with digestive issues.

Features

  • AI-powered meal logging β€” describe your meal in plain text, and GPT-4o-mini automatically extracts individual ingredients (powered by Val Town's built-in OpenAI integration β€” no API key needed!)
  • Bristol Stool Scale β€” track bowel movements using the medically-recognized 7-type scale (Type 1 = hard lumps/constipation β†’ Type 7 = watery/diarrhea), with visual color indicators and category labels
  • Digestion symptom tracking β€” log bloating, gas, and pain/cramps on a 0–5 scale with color-coded severity buttons
  • Date & time backfilling β€” pick any date/time when logging a meal or symptom, so you can add entries retroactively. On iOS, this uses the native wheel picker.
  • Smart correlation β€” ingredients are automatically linked to symptoms logged within 24 hours, or you can manually link a symptom to a specific meal
  • Insights dashboard β€” see which ingredients correlate with worse-than-average or better-than-average digestion, ranked by deviation from your baseline

Design

Built to look and feel like a native iOS app:

  • SF Pro font stack via -apple-system
  • iOS system colors (#007AFF blue, #34C759 green, #F2F2F7 grouped background)
  • Frosted glass tab bar with backdrop-filter: blur()
  • Large title navigation pattern
  • Inset grouped table views with 12px rounded corners
  • Safe area insets for notch/Dynamic Island devices
  • PWA meta tags for "Add to Home Screen"

How it works

Rendering mermaid diagram...

File structure

index.ts                       ← Hono server (API routes + frontend serving)
lib/
  db.ts                        ← SQLite schema, queries, correlation analysis
  ai.ts                        ← OpenAI ingredient extraction via std/openai
frontend/
  index.html                   ← HTML shell (iOS fonts, Twind, safe areas)
  index.tsx                    ← React entrypoint
  favicon.svg                  ← App icon
  components/
    App.tsx                    ← Root layout + iOS frosted tab bar
    LogMeal.tsx                ← Meal entry + AI extraction + date picker
    LogSymptom.tsx             ← Symptom ratings + Bristol Stool Scale + date picker
    History.tsx                ← iOS grouped list with date section headers
    Insights.tsx               ← Ingredient correlation cards with delta bars

Tech

  • Frontend: React 18 + Twind (Tailwind at runtime, no build step)
  • Backend: Hono on Val Town
  • Database: Val Town built-in SQLite (std/sqlite)
  • AI: Val Town's built-in OpenAI proxy (std/openai) β€” free tier covers gpt-4o-mini, no API key required

Usage

  1. Open the app on your phone (it's mobile-first!)
  2. Meal tab β†’ type what you ate β†’ tap "Extract Ingredients with AI" β†’ review/edit the ingredient chips β†’ pick a date if backfilling β†’ save
  3. Symptoms tab β†’ rate bloating/gas/pain β†’ select Bristol Stool Scale type β†’ optionally link to a meal β†’ pick a date if backfilling β†’ save
  4. History tab β†’ see all entries grouped by date with Bristol color indicators
  5. Insights tab β†’ see which ingredients correlate with bad digestion

The more meals and symptoms you log, the more reliable the correlations become. At least 2 meals per ingredient are needed before it appears in insights.