AI + nutrition
MealPath
Meal photo to reviewed items, nutrition and a plan: AI suggests, the user confirms, exact server-side arithmetic decides.
In the demo you analyse a sample meal photo, review the items the AI was unsure about, confirm portions, and get calculated nutrition and a ranked three-day plan. Underneath: a validated AI adapter that rejects invalid output instead of repairing it, exact arithmetic with one rounding step, versioned ranking rules, and images processed in memory and never stored.
- My role
- Sole engineer: spec to deployment
- Walkthrough
- 90-second guided scenario
- Focus
- AI behind a validated boundary
Launch guided demo (opens in a new tab)Engineering evidence
Stack: React · TypeScript · PHP/Symfony · PostgreSQL · Playwright + axe
Independently built portfolio showcase · simulated data

The business problem
People who plan meals around general nutrition preferences jump between disconnected steps: understanding what they eat, checking approximate nutrition, finding recipes and making a plan. MealPath connects uncertain AI food recognition to reliable reference data and deterministic recommendations, relevant to meal-kit and grocery businesses.
Try the workflow
Step 1

Review: the AI's suggestions need a person; nothing is calculated while items are unresolved. Step 2

Ranking: a registered, versioned rule orders recipes for higher protein with dairy excluded. Step 3

Saved plan: totals and the ingredient list come from the server, not the model.

Engineering invariants
Rules the system enforces whatever the user does, and where each one is proven.
| Invariant | Why it matters | Evidence |
|---|---|---|
| Nothing is calculated until every item is matched to a catalogue food and confirmed by the user. | AI output never reaches results without human review. | Confirmation gate (opens in a new tab)Functional/NutritionFlowTest.php :: testUnresolvedOrUnconfirmedItemsBlockConfirmation |
| AI output passes size, JSON, JSON Schema and semantic checks against the catalogue. Invalid output is rejected, never repaired; after one escalation a second failure stores nothing. | The model cannot inject unknown foods or malformed data. | Validation pipeline (opens in a new tab)Functional/LiveAnalysisTest.php :: testTwoInvalidOutputsFailWithoutPersistingAnything |
| Images are re-encoded in memory with metadata stripped and discarded after analysis; oversized images are rejected before decoding. | No photo, EXIF location or image URL is ever stored. | Image lifecycle (ADR 0005) (opens in a new tab)Unit/Shared/ImageSanitizerTest.php :: testStripsMetadataByReencoding |
System architecture
Key decisions
Fixture-first AI: a provider-independent contract, with a fixture provider for the public demo and all tests that runs the same validation. Live calls use a fast tier with at most one escalation.
Why: A reliable public demo and deterministic CI without API keys, at a low live cost.
Rejected: Always using the smartest model (about 20× the cost), automatic retries, live-only.
ADR 0003 — Fixture-first AI via OpenRouter with tiered OpenAI models
Ranking and filtering are registered, versioned rules with explanations.
Why: Deterministic and explainable; saved results record rule versions.
Rejected: LLM ranking (non-deterministic and hard to explain).
ADR 0004 — Explicit registered rule handlers instead of a rule language
Engineering evidence
Tests
PHPUnit — calculator, rules, parser, flow, live path with mocked transport
Exact-amount, calculator, parser, image sanitiser and live-path tests (with a mocked transport) in PHPUnit.
End-to-end
Playwright journey with axe
The full journey (71.0 g protein, 546.0 kcal; reset ends the session) plus checks that unresolved items block calculation. 7/7 passing on production on 26 Nov 2026.
Conditions: Desktop; smoke test also on Pixel 7
Engineering page
“How it's engineered” in the live demo (opens in a new tab)
The full detail: rules, data model, tests and measurements, next to the running product.
I use AI-assisted development for implementation, exploration and review. I remain responsible for architecture, business rules, code quality and deployment. Critical behaviour is verified with deterministic tests, static analysis and reproducible benchmarks.
Trade-offs and limits
- Synthetic reference data, not real nutrition values
- Not medical or dietary advice
- Allergen filters use catalogue declarations only; not an allergy safety guarantee
- Public demo uses a prepared sample analysis
My contribution
I built MealPath as an independent engineering showcase: product specification, architecture, frontend, backend, data model, automated tests and deployment.
Want to discuss the engineering behind this?
Launch demo (opens in a new tab)Get in touch
Source-code walkthroughs available on request.