WhatsApp-native AI nutrition coach with Stripe monetization, serving real users
Overview
Calorichat is an AI-powered nutrition tracking application that lets users log meals through natural language and receive personalized coaching. Built as an internal Astravia product, it showcases how conversational AI can simplify tedious health tracking workflows.
Role
Full-Stack Developer & Product Owner
Designed, built, and shipped end-to-end as sole technical owner.
Tech Stack
Next.jsReactTypeScriptOpenAI APIWhatsApp Business APIPostgreSQLTailwind CSS
Challenges & Approach
01
Natural Language Meal Parsing
The Challenge
Users needed to log meals in plain language (e.g. "a bowl of rice with grilled chicken and a side salad") and get accurate calorie breakdowns. The AI had to handle ambiguous quantities, regional food names, and compound dishes without frustrating the user with follow-up questions.
The Approach
Designed a multi-pass parsing pipeline: the first pass extracts individual food items and inferred portions using an LLM prompt tuned with few-shot examples, and the second pass maps each item to a nutrition database for macronutrient values. A confidence score determines whether to auto-log or ask the user for clarification, keeping the interaction smooth for common cases.
02
Streaming AI Coach Responses
The Challenge
The nutrition coaching feature needed to feel conversational and responsive. Waiting for a full LLM response before displaying it made the experience feel sluggish, especially on slower connections.
The Approach
Implemented server-sent events (SSE) to stream tokens from the AI model directly to the client as they are generated. On the frontend, a custom hook incrementally renders markdown content, giving users the impression of a real-time conversation while the full response is still being generated.
03
Personalized Nutrition Goals
The Challenge
Different users have vastly different caloric needs based on age, weight, activity level, and personal goals (weight loss, muscle gain, maintenance). The system had to adapt recommendations dynamically without requiring a complex onboarding flow.
The Approach
Built a progressive profiling system that gathers user data over the first few interactions instead of requiring a long sign-up form. Nutritional targets are recalculated on each profile update using Mifflin-St Jeor equations and activity multipliers, and the AI coach prompt is dynamically injected with the user's current goals so responses stay contextually relevant.
04
WhatsApp-First Architecture with User Context
The Challenge
We wanted to make Calorichat accessible where users already spend their time — WhatsApp. This meant architecting a system where a specialized LLM could be reached through a simple chat message, while still maintaining full user context (meal history, goals, preferences) across conversations without a traditional app interface.
The Approach
Built an integration layer on top of the WhatsApp Business API that receives incoming messages via webhooks, resolves the sender to an internal user profile, and assembles a context window with their recent meal logs, nutritional targets, and conversation history. This context is injected into the LLM system prompt on every request so the AI responds as a personalized coach — not a stateless chatbot. The architecture keeps the LLM specialized and lightweight while the context service handles all the user-state management separately.
05
Paywall in the WhatsApp Interface
The Challenge
Monetizing a product that lives entirely inside WhatsApp is a unique challenge. There is no app store, no native payment UI, and no way to gate content behind a login screen. We needed a frictionless way to enforce subscription limits and collect payments without breaking the conversational flow.
The Approach
Implemented a usage-based gating system: free-tier users get a set number of AI interactions per month, tracked server-side against their phone number. When a user hits the limit, the bot responds with a personalized message and a secure, short-lived payment link that opens a Stripe checkout page pre-filled with their account info. Once payment is confirmed via Stripe webhooks, the subscription is activated instantly and the bot resumes responding — the user never leaves the WhatsApp thread for more than a few seconds.
06
AI Tool Calls for Database Manipulation
The Challenge
Users needed to create, edit, and delete meal records and profile data entirely through natural conversation. Telling the AI "actually that was a small coffee, not a large" or "log a banana for yesterday's breakfast" required the model to understand intent and translate it into precise database operations — without exposing raw CRUD endpoints to the user.
The Approach
Leveraged the OpenAI function-calling (tool use) API to define a set of structured tools the LLM can invoke: create_meal_record, update_meal_record, delete_meal_record, and update_user_profile. Each tool has a strict JSON schema that the model must satisfy. When the model decides an action is needed, it emits a tool call with the structured parameters; the backend validates the payload, enforces ownership checks, executes the database operation, and returns the result to the model so it can confirm the change to the user in natural language. This keeps the AI in the driver's seat for UX while the backend retains full control over data integrity and authorization.