AWS Builder Center

Weekend Showcase Challenge: NutriAI — Your Always-On AI Nutrition Agent

Real-Time Food Advisor

The Problem I Set Out to Solve

Every morning, millions of people open a calorie-counting app and face the same frustrating experience: a blank slate. You have to remember what you ate yesterday, manually estimate portions, and hope your gut feeling about tonight's dinner is actually healthy. There's no intelligence behind it — just a ledger.
I wanted to build something different. What if your nutrition app actually knew you? What if it woke up every morning, reviewed how you ate yesterday, and had a personalised meal plan waiting for you before you even picked up your phone?
That idea became NutriAI — a serverless, always-on AI nutrition agent powered by Amazon Bedrock and AWS Lambda. It doesn't just track what you eat. It thinks about it, advises you in real time, and plans proactively for tomorrow.



What NutriAI Does

NutriAI is a full-stack nutrition companion with two distinct modes of intelligence:

1. Real-Time Food Advisor

You type any food — "200g biryani", "1 banana", "a samosa" — and before you log it, NutriAI gives you a verdict:
  • ✅ Go For It! — This fits your targets, log it.
  • ⚠️ Eat Mindfully — It's okay but watch your next meal.
  • ❌ Skip — You're already at your limit for the day.
Behind the scenes, the app first calls the Open Food Facts public API for real nutritional data. If the food isn't found (especially common for Indian foods like chapati, dal, idli), it falls back to a hand-curated local database of 30+ foods including regional staples. The nutrition data is then sent to a Lambda function, which calls Amazon Bedrock (Claude 3 Haiku) to generate a personalised, conversational response that considers your remaining daily budget — not just the food in isolation.

2. The Always-On Daily Planner Agent

Every morning at 6:00 AM IST, an EventBridge Scheduler triggers the Planner Lambda automatically — no user action required. The agent:
  1. Reads yesterday's food log from DynamoDB
  1. Checks whether you hit your calorie and macro targets
  1. Generates a personalised meal plan for today using Bedrock
  1. Stores the plan in DynamoDB, ready to display when you open the app
This is the "always-on" part that made the build feel truly like an agent, not just an app. When you open NutriAI in the morning, the plan is already there — warm, contextual, and tailored to how yesterday went.

Dashboard

The frontend (HTML/CSS/JS, hosted on S3 + CloudFront) features:
  • Animated macro rings — real-time SVG rings for calories, protein, carbs, and fat
  • Daily progress bar — colour-coded (green → amber → red as you approach your limit)
  • Food log with per-item macro breakdown and one-click delete
  • Reminder notifications — browser-native reminders every N hours to log your meals
  • Settings panel — customise your daily targets, API endpoint, and reminder interval



How I Built It

Week 1: The Wishlist Idea

The summer started with a wishlist challenge. I knew I wanted to build something health-related. The specific insight that sparked NutriAI was noticing how most nutrition apps are reactive — they only respond when you open them. I wanted an agent that works for you in the background.

Week 2: The Creative App

I built the frontend first: a single-page app with a dark, glassmorphism aesthetic. The key early decision was to use Open Food Facts as the nutrition data source, since it's free, open-source, and has a massive global database. But I quickly found it was missing many Indian foods — so I added a local estimation database with 30+ items (rice, dal, chapati, biryani, idli, dosa, paneer, and more) as an intelligent fallback.
Getting the UI right took longer than expected. The macro rings use SVG stroke-dashoffset animation — a technique that lets you animate the ring fill smoothly as calories accumulate. Making it feel alive rather than static was a design priority.

Week 3: The Always-On Agent

This was the most technically interesting week. The always-on behavior required two separate Lambda functions:
Advisor Lambda ( nutriai-advisor ):
  • Receives a POST with food name, quantity, current totals, and targets
  • Calls Bedrock with a structured prompt that includes remaining macro budget
  • Returns a JSON verdict:  {verdict, title, message, tips} 
  • Has a rule-based fallback if Bedrock is unavailable — the app never breaks
Planner Lambda ( nutriai-planner ):
  • Dual-mode: handles both HTTP GET  /plan  (browser) and EventBridge-triggered scheduled runs
  • On scheduled runs: reads DynamoDB for yesterday's data, generates contextual Bedrock plan, writes today's record back
  • On HTTP GET: checks if today's plan exists in DynamoDB and serves it; if not, generates on-demand
  • Graceful fallback to pre-written day-of-week templates if Bedrock is unavailable
The most important architectural decision was choosing HTTP API Gateway (v2) over the classic REST API. It's significantly cheaper and faster, which matters for a free-tier project.

Key Challenges

CORS hell. Getting the browser, API Gateway, Lambda, and Bedrock all talking to each other without CORS errors took far more debugging than I expected. The solution was configuring CORS at the API Gateway level and returning explicit headers in every Lambda response, including OPTIONS preflight requests.
Indian food database. Open Food Facts has limited coverage of South Asian foods. I built a curated local fallback with 30 foods including regional staples. The matching uses substring search so "chicken biryani" correctly resolves to "biryani" in the database.
DynamoDB cold start. The planner agent uses  userId: 'default'  for this single-user prototype. In production, you'd partition by actual user IDs and add authentication. I used TTL (7-day expiry) to keep the table lean.
CloudFormation complexity. The entire infrastructure is defined in a single  template.yaml  (325 lines) using AWS SAM/CloudFormation. Getting all the IAM roles, API Gateway integrations, Lambda permissions, and EventBridge scheduler wired up correctly — especially the scheduler's IAM trust policy — required careful reading of the documentation.



AWS Services Used & Architecture

Browser (S3 + CloudFront)
│
├── POST /advisor ──► API Gateway (HTTP API) ──► Lambda (advisor)
│ │
│ Amazon Bedrock
│ (Claude 3 Haiku)
│
├── GET /plan ─────► API Gateway (HTTP API) ──► Lambda (planner) ──► DynamoDB
│
└── Scheduled ─────► EventBridge Scheduler ──► Lambda (planner) ──► DynamoDB
│
Amazon Bedrock
(Claude 3 Haiku)
Service
Role
Amazon S3
Static website hosting — HTML, CSS, JS
Amazon CloudFront
Global CDN, HTTPS, edge caching
AWS Lambda
Two functions: real-time advisor + always-on planner agent
Amazon API Gateway (HTTP)
REST endpoints connecting browser to Lambda
Amazon DynamoDB
Food log and AI plan persistence with TTL
Amazon Bedrock (Claude 3 Haiku)
Conversational AI advice and personalised daily plans
Amazon EventBridge Scheduler
Triggers the planner agent at 6 AM IST daily
AWS IAM
Roles for Lambda→Bedrock, Lambda→DynamoDB, Scheduler→Lambda
AWS CloudFormation
Full infrastructure-as-code in one 325-line template
Everything runs within the AWS Free Tier. DynamoDB is on-demand billing, Lambda gets 1M free requests/month, and EventBridge Scheduler triggers are free up to 14M invocations.



What I Learned Across the Summer

Agents need graceful degradation more than anything else. My first version of the Advisor Lambda crashed the entire app if Bedrock returned an unexpected response format. Now every layer has a fallback — Lambda falls back to rule-based logic, and the frontend has its own smart advisor if the API is unreachable. Resilience isn't optional for always-on systems.
"Always-on" is a mindset shift. Building the EventBridge planner forced me to think like a backend engineer for the first time — not about what happens when the user clicks something, but about what should happen at 6 AM when nobody is watching. That shift in thinking was the most valuable part of this summer.
Infrastructure-as-code pays off immediately. Writing everything in CloudFormation meant I could tear down and redeploy the entire stack in minutes during debugging. It also forced me to think about IAM permissions explicitly, which taught me a lot about AWS security.
Open data is underrated. Open Food Facts is a remarkable resource — millions of food products with full nutrition data, freely available. I went in expecting to build a paid API integration and came out with a better, free solution.
Prompting is an engineering skill. Getting Claude to return valid, structured JSON reliably required careful prompt engineering — explicit instructions, format constraints, and defensive parsing on the receiving end. A vague prompt gives vague results; a precise prompt gives predictable, reliable output.



Try It Yourself

The project is fully deployed on AWS. You can check out the infrastructure template and Lambda source code in the repository:
To deploy your own instance:
# Clone and deploy (requires AWS CLI + PowerShell)
.\deploy.ps1
The deploy script uses AWS CLI to create the CloudFormation stack, upload Lambda ZIPs, and sync the frontend to S3 — full deployment in under 5 minutes.



Shoutout

A huge thanks to Lewis Sawe (@lewissawe) for the inspiration — their Museum That Grows project perfectly captured what an always-on agent should feel like: something that quietly does meaningful work in the background without needing your attention. That framing helped me understand what I was actually trying to build with the NutriAI planner.


NutriAI was built as part of the AWS Summer Build Series 2026. It uses Amazon Bedrock, Lambda, DynamoDB, EventBridge, API Gateway, S3, and CloudFront — all within the AWS Free Tier.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article