AWS Builder Center
Weekend Annoying Task Challenge: MealMate - AI Weekly Meal Planner & Grocery List Generator

Weekend Annoying Task Challenge: MealMate - AI Weekly Meal Planner & Grocery List Generator

Every week, the same question haunts Indian families:  (What should we cook today?). Planning meals for an entire week while balancing nutrition, variety, budget, and family preferences is genuinely exhausting. Add grocery shopping to the mix figuring out quantities for 4+ people, remembering every spice and vegetable and you've got a task that eats up hours every single week.

Vision & What the App Does

The Problem

Every week, millions of Indian families face the same exhausting ritual: "What should we cook today?" What seems like a simple question quickly spirals into a complex decision-making nightmare:
  • Balancing nutrition across 21 meals per week
  • Avoiding dish repetition (nobody wants the same curry three days in a row!)
  • Accommodating dietary preferences (vegetarian, non-veg, allergies)
  • Staying within a weekly grocery budget
  • Planning for different family sizes
  • Then comes the grocery list — calculating quantities for 4+ people, remembering every vegetable, spice, and staple item
This "small" weekly task easily consumes 2-3 hours of mental energy. Multiply that across 52 weeks, and you're spending over 100 hours a year just deciding what to eat.

The Solution: MealMate

MealMate is an AI-powered weekly meal planner that eliminates this entire headache in under 30 seconds. Here's what it does:
  • 7-Day Meal Plans: Generates complete breakfast, lunch, and dinner plans for Monday through Sunday
  • Indian Cuisine Focus: Supports South Indian, North Indian, and mixed cuisine preferences
  • Diet Customization: Vegetarian, Non-Vegetarian, Eggetarian, and Vegan options
  • Family-Size Aware: Adjusts portions and quantities for 1-10 family members
  • Budget Conscious: Plans meals within your specified weekly budget (in INR)
  • Auto Grocery Lists: Generates categorized shopping lists with exact quantities and estimated prices
  • Allergy Safe: Respects dietary restrictions and allergies
  • Instant Regeneration: Don't like a plan? Generate a new one in seconds
The app transforms a 2-hour weekly chore into a 30-second interaction. Set your preferences once, hit generate, and your entire week is planned — meals and groceries included.



How I Built It

Development Process

I chose a serverless-first approach using AWS SAM CLI for the entire development lifecycle. The goal was to build something functional, deployable, and cost-effective within a weekend.
Day 1: Planning & Backend
  • Defined the architecture and API endpoints
  • Created the SAM template (template.yaml) defining all infrastructure as code
  • Wrote three Lambda functions:
  •  generate-plan : Takes user preferences, calls Amazon Bedrock, and returns a 7-day meal plan
  •  grocery-list : Takes a meal plan, calls Bedrock, and returns a categorized grocery list with prices
  •  save-preferences : Stores and retrieves user preferences from DynamoDB
  • Deployed using  sam build && sam deploy --guided 
  • Tested all endpoints with curl
Day 2: Frontend & Polish
  • Built a single-page HTML/CSS/JavaScript frontend (no frameworks — keeping it simple!)
  • Implemented responsive design for mobile and desktop
  • Connected frontend to API Gateway endpoints
  • Deployed frontend to S3 with static website hosting
  • Pushed everything to GitHub

Key Decisions

  1. Single HTML File Frontend: Instead of React or Angular, I chose a single HTML file. Zero build tools, zero dependencies, instant deployment to S3. For a weekend project, simplicity wins.
  1. Amazon Nova Lite Model: Chose Nova Lite for its speed, cost-effectiveness, and strong performance with structured JSON output. Perfect for generating meal plans in a specific format.
  1. DynamoDB Single-Table Design: Used a composite key pattern (PK/SK) to store both preferences and meal plan history in one table. Pay-per-request billing means zero cost when idle.
  1. Fallback Strategy: Implemented graceful fallback with curated sample meal plans when Bedrock is unavailable. The app always returns a useful response.

Challenges & How I Overcame Them

Challenge 1: Bedrock Model Access
The Model Access page in Amazon Bedrock was recently retired. Models are now auto-enabled on first invocation, but I initially encountered "Operation not allowed" errors. The fix involved ensuring the Lambda execution role (not just my IAM user) had the  AmazonBedrockFullAccess  policy attached. Key learning: Lambda functions use their own IAM role, separate from your CLI user.
Challenge 2: Nova Lite Response Format
Amazon Nova models use a different request/response format than older models like Titan. The correct format uses a  messages  array with  role  and  content  fields, and responses come back in  output.message.content[0].text  (note:  content  is a list, not a string!). Debugging this required careful reading of the Bedrock documentation.
Challenge 3: JSON Parsing from AI Output
AI models sometimes wrap JSON in markdown code blocks or add explanatory text. I built robust parsing logic that strips markdown wrappers, handles multiple formats, and falls back gracefully to raw text if JSON parsing fails.
Challenge 4: CORS Configuration
Cross-origin requests from the S3-hosted frontend to API Gateway required CORS headers in three places: the API Gateway resource configuration (in the SAM template), Lambda response headers (every response must include Access-Control-Allow-Origin), and preflight OPTIONS handling.
Challenge 5: Windows CMD Encoding
Running AWS CLI commands on Windows CMD with JSON payloads caused encoding issues (Invalid base64 errors). The solution was to save JSON to a file and use  fileb://filename.json  for the  --body  parameter.



AWS Services Used / Architecture Overview

Services Used

AWS Service
Purpose
Why I Chose It
Amazon Bedrock (Nova Lite)
AI generation of meal plans and grocery lists
Fast, cost-effective, excellent structured output
AWS Lambda
3 serverless backend functions
Zero idle cost, auto-scaling, Python 3.12 runtime
Amazon API Gateway
REST API with CORS support
Fully managed, seamless Lambda integration
Amazon DynamoDB
Store preferences and meal history
Pay-per-request, single-table design
Amazon S3
Static website hosting
Simple, inexpensive, reliable frontend hosting
AWS CloudFormation
Infrastructure deployment
Via SAM template — entire stack in one file
AWS IAM
Security and permissions
Least-privilege access for Lambda roles

Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│ USER (Browser) │
└─────────────────────────┬───────────────────────────────────────┘
│ HTTPS
▼
┌─────────────────────────────────────────────────────────────────┐
│ Amazon S3 (Frontend) │
│ Static HTML/CSS/JS Website │
└─────────────────────────┬───────────────────────────────────────┘
│ API Calls (POST/GET)
▼
┌─────────────────────────────────────────────────────────────────┐
│ Amazon API Gateway (REST) │
│ /generate-plan | /grocery-list | /preferences │
└────────┬────────────────┼─────────────────┼─────────────────────┘
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Lambda: │ │ Lambda: │ │ Lambda: │
│ GeneratePlan │ │ GroceryList │ │ SavePrefs │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
▼ ▼ ▼
┌──────────────────────────────┐ ┌──────────────┐
│ Amazon Bedrock │ │ DynamoDB │
│ (Nova Lite v1 - AI Model) │ │ (MealMate │
│ │ │ Table) │
│ Generates meal plans & │ │ │
│ grocery lists via prompts │ │ Stores prefs │
└──────────────────────────────┘ │ & meal plans │
└──────────────┘


How the Agent is Triggered

  1. User Action: The user fills in the preferences form and clicks "Generate Meal Plan"
  1. API Call: The frontend sends a POST request to the API Gateway endpoint
  1. Lambda Invocation: API Gateway triggers the appropriate Lambda function
  1. AI Processing: Lambda constructs a detailed prompt with user preferences and calls Amazon Bedrock's Nova Lite model
  1. Response Flow: Bedrock returns AI-generated content → Lambda parses the JSON → saves to DynamoDB → returns a structured response to the frontend
  1. Display: The frontend renders the meal plan as a formatted table or the grocery list with categories, quantities, and prices

Infrastructure as Code

The entire infrastructure is defined in a single  template.yaml  file using AWS SAM:
  • 3 Lambda functions with appropriate IAM policies
  • 1 API Gateway with CORS configuration
  • 1 DynamoDB table with pay-per-request billing
  • All outputs (API URL, Lambda ARNs) are auto-generated
Deployment is a single command:  sam build && sam deploy 
Working

result




What I Learned

New Skills Acquired

  1. AWS SAM CLI Mastery: This was my first time using SAM for a complete project. The  sam build → sam deploy --guided  workflow is incredibly powerful. One YAML file replaces hours of manual console clicking.
  1. Amazon Bedrock Integration: I learned the Nova Lite model's request/response format, prompt engineering for structured JSON output, and handling AI response variability gracefully.
  1. Serverless Architecture Patterns: Understanding how Lambda execution roles work differently from IAM user permissions was a crucial "aha moment." The Lambda function needs its OWN Bedrock permissions — your CLI user's permissions don't carry over.
  1. DynamoDB Single-Table Design: Using composite keys (PK:  USER#id , SK:  PLAN#timestamp ) to store multiple entity types in one table is elegant and cost-effective.
  1. Prompt Engineering: Crafting prompts that consistently return valid JSON is an art. Being explicit about the format, providing examples, and instructing "Return ONLY valid JSON, no extra text" dramatically improves reliability.

Key Takeaways

  • Start Simple: A single HTML file plus S3 beats a complex React setup for weekend projects
  • Fallback Strategy: Always have a Plan B. When AI services have issues, graceful degradation keeps your app functional
  • IAM is Everything: 90% of AWS debugging comes down to IAM permissions. When in doubt, check the role policies
  • Serverless Equals Zero Idle Cost: My entire backend costs nothing when nobody is using it. Perfect for side projects
  • Infrastructure as Code: Never click through the console for production resources. A SAM template gives you reproducible, version-controlled infrastructure

What I Will Use Again

Amazon Bedrock combined with Lambda is a powerful combination for AI-powered applications. The ability to call foundation models without managing any ML infrastructure is game-changing. I am already planning my next project using this stack.



Link to App or Repo

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