All work

MacroMesh

Natural-language meal logging with grounded, schema-validated LLM output.

Next.js and SwiftUI clients over a Prisma/PostgreSQL backend. LLM parsing grounded in USDA and Open Food Facts data, structured output validation with fallback, human review before save, and idempotent writes.

Year
2025 to present
Role
Sole developer: product design, web and iOS clients, AI pipeline, data model
Built with
Next.js, TypeScript, SwiftUI, PostgreSQL, Prisma, OpenAI API
Type
Applied AI, web and iOS

The 30-second summary

Problem
A short meal description is easy to enter but hard to match to the right food.
What I built
I built web and iOS clients with grounded suggestions, validation, and a review step before saving.
Result
Correct branded-food matches rose from 3 of 25 to 21 of 25 on the same fixed offline benchmark.

The problem

Typing a meal should be easy. Turning that description into dependable food records is harder: similar names, ambiguous portions, mismatched brands, and repeated save requests can all quietly undermine a nutrition log.

MacroMesh makes meal logging a conversation with a review step. Food candidates are grounded in catalog and provider data, checked against structured expectations, and presented for human confirmation before they enter the user’s history.

Key decisions

Resolve food before trusting an estimate.

The pipeline combines a verified catalog, USDA FoodData Central, and Open Food Facts with LLM-assisted fallback. Candidate normalization, ranking, and source labels make uncertainty visible. Provider availability depends on configuration.

Give the person the final say.

Structured output validation catches malformed responses. Human-in-the-loop review lets a user correct food identity and portions before saving. The language model assists the workflow rather than deciding silently.

Make repeated requests safe.

Idempotency keys, Prisma transactions, and database uniqueness constraints work together to prevent duplicate meal saves. Data integrity belongs in the backend as well as the interface.

Architecture

  1. Layer 1 of 3

    Web & native clients

    Next.js and TypeScript on the web; SwiftUI for iOS. Both serve conversational logging, review, history, and progress tracking.

  2. Layer 2 of 3

    Food resolution

    Normalize requests, resolve candidates from food sources, validate structured model output, and fall back when required.

  3. Layer 3 of 3

    Review & persistence

    User confirmation precedes saving. Prisma and PostgreSQL provide transactional persistence and uniqueness enforcement.

Security and testing

Security and integrity

Provider credentials belong on the server. Input and model output validation define explicit boundaries between generated suggestions and persisted data. Review-before-save and idempotency protect the integrity of the user’s log.

Testing and evidence

On a fixed offline benchmark of 25 branded foods, matching improved from 3 to 21 passing cases (12% to 84%). That is one test set measured before and after the change, not a claim about general nutrition accuracy. Food identity regression tests, provider behaviour tests and save-conflict tests guard the pipeline.

Before3 of 25
After21 of 25
Each square is one case in a fixed offline set of 25 branded foods. Same set, before and after the matching work. This is not a measure of general accuracy.

Status and limits

The web app is live as a public demo. The SwiftUI iOS client lives in the same repository with TestFlight release workflows; it is not on the App Store. The project began as Calorie Compass, and the web deployment still carries that name.

The most useful AI feature is not a confident answer. It is a dependable workflow around an answer that might need correcting.

Next case studyIncidentOPSRead it