DEV Community

Cover image for I Built an AI Meal Planner That Saves Families $200/Month on Groceries
Shirisha Uppoju
Shirisha Uppoju

Posted on

I Built an AI Meal Planner That Saves Families $200/Month on Groceries

Every Sunday my family had the same conversation:

"What should we cook this week?"

30 minutes of arguing later, we'd end up ordering takeout. Again. $60 gone. Again.

I got tired of it, so I built MealAI — an AI-powered meal planner that generates a full week of meals in seconds and creates a smart grocery list you can order with one tap.

Here's how I built it and what I learned.

The Problem

Meal planning is broken for most families:

  • It takes 30-60 minutes every week to plan meals
  • You forget ingredients and make multiple grocery trips
  • You overspend because you buy without a plan
  • Everyone in the family has different dietary needs

I wanted something that could handle all of this in under 30 seconds.

The Tech Stack

  • Framework: Next.js (App Router)
  • AI: Claude API (Anthropic)
  • Database: Supabase (PostgreSQL + Auth)
  • Payments: Stripe
  • Hosting: Vercel
  • Styling: Tailwind CSS

Why These Choices?

Next.js App Router — Server components for fast initial loads. API routes that scale to zero on Vercel. The file-based routing made it easy to add new pages fast.

Claude AI over GPT — I tested both extensively. Claude produces more structured, consistent meal plan outputs. When you ask for a 7-day meal plan with macros, calorie counts, and ingredient quantities, Claude rarely hallucinates numbers. GPT-4 would sometimes give you a 1200-calorie "meal" that was actually 800.

Supabase — PostgreSQL with built-in auth, row-level security, and a generous free tier. Perfect for a bootstrapped SaaS. The RLS policies mean I never worry about users accessing each other's data.

Vercel — Deploy on push. Edge functions. Free SSL. No DevOps needed.

How the AI Meal Planning Works

The core flow is simple:

User Preferences --> Prompt Engineering --> Claude API --> Structured JSON --> Database

The user sets their profile once:

  • Dietary preference (keto, vegan, vegetarian, Mediterranean, etc.)
  • Allergies and restrictions
  • Family size and per-member preferences
  • Weekly grocery budget
  • Preferred cuisines (14 options from Indian to Korean)
  • Health goals (weight loss, muscle gain, etc.)

Then I construct a detailed prompt that includes all of this context and ask Claude to generate a 7-day meal plan as structured JSON.

The key insight: prompt engineering is 90% of the product quality. I spent more time refining the prompt than writing the UI. Small changes like "ensure each day totals within 50 calories of the target" dramatically improved output consistency.

The Smart Grocery List

This is where MealAI goes beyond a simple AI wrapper.

The AI generates meals with specific ingredients and quantities. I aggregate these across all 21+ meals in the week, combine duplicates (you don't need 7 separate "1 onion" entries), and sort by grocery aisle.

Then users can order everything on Instacart, Walmart, or Amazon with one tap.

Security: What I Wish I Knew Before Launch

When I first deployed, I had zero security beyond Supabase auth. Here's what I added before going live:

Rate Limiting — Sliding window rate limiter on all API routes. The AI generation endpoint gets 5 requests/minute. Without this, one user could burn through your entire Claude API budget.

Input Validation — Every user input gets validated server-side. Age must be 1-150. Weight must be 10-500kg. HTML tags get stripped from all text inputs.

Field Whitelisting — API update endpoints only accept specific fields. Without this, a malicious user could send a modified stripe_customer_id and steal another user's subscription.

Security Headers — CSP, HSTS, X-Frame-Options, Referrer-Policy via next.config.ts.

The lesson: Security isn't a feature you add later. Build it from day one.

Monetization Strategy

MealAI uses a freemium model:

  • Free tier — Limited meal plan generations per month
  • Pro ($4.99/mo) — Unlimited plans, family profiles, advanced health features

Plus affiliate revenue from grocery delivery links. When a user orders groceries through our Instacart or Amazon links, we earn a commission.

Lessons Learned

1. Solve your own problem first
I built MealAI because my family needed it. That meant I was my own first user and could feel every pain point.

2. AI output quality > UI polish
Users forgive an ugly button. They don't forgive a meal plan that suggests "chicken breast salad" for every single lunch. Spend time on your prompts.

3. Vercel's serverless has gotchas
In-memory state doesn't persist between function invocations. I initially built an in-memory analytics logger that worked perfectly locally but lost all data in production. Had to migrate to Supabase-backed persistence.

4. Ship fast, secure early
I launched with basic auth and added security hardening before announcing publicly. Don't wait until you have users to add rate limiting.

5. Affiliate programs are harder than you think
Many affiliate networks reject new sites with low traffic. Apply early, get rejected, reapply later. Start with programs that have lower barriers like Amazon Associates.

What's Next

  • Email notifications for weekly meal plan reminders
  • Recipe sharing between users
  • Instacart deep linking with affiliate tracking
  • Mobile app (React Native)
  • Multi-language support

Try It Out

MealAI is live at usemealai.com. Free to use — just sign in with Google and generate your first meal plan in 30 seconds.

I'd love your feedback. What features would make this useful for your family?


If you found this useful, follow me for more posts about building AI-powered SaaS products as a solo developer.

Top comments (1)

Collapse
 
bhavin-allinonetools profile image
Bhavin Sheth

Love this — especially the part about prompt quality being the real product. I’ve seen the same: UI can be simple, but if output is off, users drop instantly. Also +1 on solving your own problem first, that is what actually makes tools stick.