WEB_APP

Weekly Meal Planner

Weekly Meal Planner - Documentation Summary

A comprehensive documentation suite covering the Weekly Meal Planner application - an AI-powered web app for planning weekly meals with breakfast, lunch, and dinner options.


Documentation Overview

Document Purpose Key Content
USE_CASES.md Functional requirements User flows, interactions, system behaviors
PROBLEMS.md Problem domain analysis Challenges solved by the application
SOLUTIONS.md Technical documentation Architecture decisions and implementation details

Quick Reference

Application Core Features

  1. AI Meal Generation - One-click weekly plan creation (21 meals)
  2. Recipe Bookmarking - Save favorites for future reference
  3. Plan Management - Save, load, edit, and delete weekly plans
  4. Cross-Device Sync - Access plans from any device
  5. Responsive Design - Usable on desktop, tablet, and mobile

Tech Stack Summary

Layer Technology
Framework Next.js (App Router)
Language TypeScript (strict mode)
Styling Tailwind CSS + Shadcn UI
AI SDK Vercel AI SDK
Authentication Clerk
Deployment Cloudflare Workers
State React Query + IndexedDB
Testing Vitest + Playwright

Problem-Solution Mapping

Problem Area Solution Implemented
Decision fatigue AI-powered batch generation
Cross-device access Cloudflare edge + Clerk auth
Offline capability IndexedDB local storage
Mobile kitchen use Responsive + touch-first UI
Rate limiting Per-user API quotas
Type safety Zod schemas + TypeScript

User Flow Summary

┌─────────────────────────────────────────────────────────────┐
│                        USER ENTRY                         │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                    Google Sign-In (Optional)               │
│               Anonymous: 3 generations                  │
│               Authenticated: 7 generations               │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                    Generate Weekly Plan                  │
│               AI generates 21 meals (7 days × 3)          │
│               Streaming UI updates in real-time           │
└─────────────────────────────────────────────────────────────┘
                              │
                    ┌────────┴────────┐
                    ▼                 ▼
         ┌──────────────┐    ┌──────────────┐
         │ View Recipes │    │ Save Plan    │
         │   Details   │    │ (Auth only)  │
         └──────────────┘    └──────────────┘
                                    │
                                    ▼
                             ┌──────────────┐
                             │  Manage      │
                             │  Saved Plans │
                             └──────────────┘

Architecture Highlights

State Management Strategy

Server State ──► React Query ──► Cached & Synced
     │
UI State ──► Local useState ──► Ephemeral
     │
Cross-cutting ──► React Context ──► Minimal Scope
     │
Persistence ──► IndexedDB ──► Offline Ready
     │
Remote ──► Clerk + API ──► Cloudflare Edge

Key Design Decisions

Decision Rationale
App Router Server-first, streaming, RSC
Shadcn UI Copy-paste ownership, customizable
Zod validation Runtime + compile-time safety
Cloudflare Global low-latency deployment
IndexedDB Offline recipe caching

Quality Metrics

Metric Target Implementation
TypeScript 100% strict No implicit any, strict nulls
Testing Unit + E2E Vitest + Playwright
Linting Zero warnings Oxlint + Oxfmt
Performance LCP < 2.5s Code splitting, edge caching
Accessibility WCAG 2.1 AA Semantic HTML, ARIA labels

File Structure

docs/
├── USE_CASES.md       # Functional requirements
├── PROBLEMS.md        # Problem domain analysis
├── SOLUTIONS.md       # Technical architecture
└── SUMMARY.md         # This document

src/
├── components/
│   ├── meal-planner/  # Core meal planning UI
│   └── ui/           # Shadcn component library
├── hooks/            # Custom React hooks
├── lib/              # Utilities, storage, Redux
├── contexts/         # React Context providers
├── schemas/          # Zod validation schemas
└── server/           # API routes, agent, database

app/
├── api/v1/           # Typed API endpoints
├── page.tsx          # Main application
└── saved/            # Saved plans page

Key Endpoints

Endpoint Purpose
POST /api/v1/meal-generators AI meal plan generation
POST /api/v1/bookmarks Recipe bookmarking
POST /api/v1/generation-limits Rate limit management
GET /api/v1/dashboard User dashboard data

Getting Started

# Clone the repository
git clone https://github.com/achmadk/weekly-meal-planner.git
cd weekly-meal-planner

# Install dependencies
pnpm install

# Set up environment
cp .env.example .env
# Edit .env with required API keys

# Run development server
pnpm dev

# Run tests
pnpm test

# Build for production
pnpm build

Live Application


Further Reading