- SPEC.md: project specification and goals - ARCHITECTURE.md: system design and component descriptions - database-schema.md: PostgreSQL schema with all tables - implementation-plan.md: 12-phase implementation guide - RUNNING.md: deployment and troubleshooting guide - ORIENTATION.md: context compaction recovery guide - README.md: project overview and quick start Family profile: 2 adults, 2 children. Mushroom avoidance for 3/4. Approval workflow: email proposals, one denial swaps meal. Tech stack: FastAPI, PostgreSQL, React, Playwright, SendGrid.
8.0 KiB
Meal Planner - Orientation Guide
This document is the first stop for any agent resuming work on this project after context compaction. Read it before doing anything else.
Project Overview
MealPlanner is a self-hosted meal planning system for a family of 4 (2 adults, 2 children) that integrates with Lucky California grocery store to source ingredients from weekly sales, sends meal proposals via email, generates shopping lists, and learns from feedback.
Key Problem Being Solved
The family has been using meal kit services (Blue Apron → EveryPlate → HungryRoot → Sunbasket) which suffer from:
- 3x ingredient markup in cost
- Repetitive meals and sauces
- Forcing app login to manage meal selection
- No home pantry integration
Current Status
Phase: Documentation complete. Implementation NOT started.
All planning documents are written and committed. The next step is Phase 1: Infrastructure & Foundation (setting up Docker, PostgreSQL, FastAPI skeleton, React frontend).
Key Files
| File | Purpose |
|---|---|
docs/SPEC.md |
Full project specification (goals, constraints, user stories) |
docs/ARCHITECTURE.md |
System architecture, component descriptions, data flow |
docs/database-schema.md |
PostgreSQL schema with all tables, indexes, relationships |
docs/implementation-plan.md |
12-phase implementation plan with verification commands |
docs/RUNNING.md |
Deployment guide, troubleshooting, environment setup |
README.md |
Project overview and quick start |
meal-planner-plan.md |
Original planning file (may be superseded) |
Architecture Summary
User (email) ──► SendGrid ───────────────────────────────┐
User (web) ───► React UI ──► nginx ──► FastAPI ──────────┼──► PostgreSQL
│ │
└──► Lucky California scraper ──┘
Services (Docker Compose)
- backend: FastAPI Python app (port 8000)
- frontend: React + Tailwind (port 3000, served via nginx)
- db: PostgreSQL 15 (port 5432)
- nginx: Reverse proxy with SSL (ports 80/443)
Tech Stack
- Backend: Python 3.11, FastAPI, SQLAlchemy, Alembic
- Frontend: React 18, TypeScript, Tailwind CSS, React Query
- Database: PostgreSQL 15
- Scraping: Playwright, BeautifulSoup
- Email: SendGrid
- Hosting: Docker Compose, nginx
Family Profile
- Household: 2 adults, 2 children
- Dietary: One adult + one child like mushrooms; other adult + one child do NOT
- Goals: Calorie, budget, and health conscious; tasty but not expensive
- No allergies
Approval Workflow
- System generates 7-day meal plan (Sunday)
- Email sent to both adults with meals, images, Approve/Deny links
- One denial → meal swapped with alternative
- No denials (or silence) → meal auto-approved
- After all approvals → shopping list generated
Database Schema Highlights
Core Tables
family_profile- Household configurationrecipe- All recipes with ingredients (JSONB), instructions, image URLsingredient- Master ingredient list with aisle, price, seasonmeal_plan- Weekly plan (7 days)meal_plan_item- Individual meal with approval_token, statushome_pantry- Family's on-hand ingredientsfeedback- Ratings, denial reasons, never-suggest flagsgrocery_item- Scraped Lucky California items with sale pricesscrape_log/email_log- Operation history
Key Relationships
family_profile1:Nmeal_planfamily_profile1:Nhome_pantryrecipeN:Ningredient(viarecipe_ingredientjunction table)meal_plan1:Nmeal_plan_itemmeal_plan_item1:1feedback
Implementation Phases
| Phase | Description | Status |
|---|---|---|
| 1 | Infrastructure (Docker, PostgreSQL, FastAPI, React, nginx) | Not Started |
| 2 | Database & Models (SQLAlchemy models, Alembic migrations) | Not Started |
| 3 | API Endpoints (CRUD, meal plans, shopping list, feedback) | Not Started |
| 4 | Lucky California Scraper (weekly ad, Playwright) | Not Started |
| 5 | Recipe Engine (CRUD, tagging, search) | Not Started |
| 6 | Meal Planner Engine (generation algorithm, substitutions) | Not Started |
| 7 | SendGrid Email Integration | Not Started |
| 8 | Web UI - Core (Dashboard, Meal Detail, Approval, Pantry) | Not Started |
| 9 | Web UI - Feedback (Feedback Portal, Learning) | Not Started |
| 10 | Shopping List & Print | Not Started |
| 11 | Image Strategy (scraped + AI fallback) | Not Started |
| 12 | Polish & Future (variety analysis, budget tracking) | Not Started |
Environment Variables Required
# Database
DATABASE_URL=postgresql://mealplanner:password@db:5432/mealplanner
POSTGRES_PASSWORD=secure_password
# SendGrid
SENDGRID_API_KEY=SG.xxx
# Family
FAMILY_EMAIL_1=user@example.com
FAMILY_EMAIL_2=spouse@example.com
# Scraping
LUCKY_CA_URL=https://www.luckyncal.com
# AI Images (optional)
AI_IMAGE_ENABLED=false
Next Steps
IMMEDIATE: Start Phase 1
- Create
docker-compose.ymlwith all 4 services - Create backend directory structure and FastAPI skeleton
- Create frontend with Vite + React + TypeScript + Tailwind
- Set up nginx reverse proxy config
- Create
.env.examplefile
After Phase 1 Complete
- Verify all services start:
docker-compose up -d && docker-compose ps - Test health endpoint:
curl localhost:8000/health - Test frontend builds:
cd frontend && npm run build
Current Git State
git log --oneline
# (empty - no commits yet)
All documentation is written but NOT YET COMMITTED. Commit with:
git add docs/ README.md meal-planner-plan.md
git commit -m "docs: add complete project documentation
- SPEC.md: project specification and goals
- ARCHITECTURE.md: system design and component descriptions
- database-schema.md: PostgreSQL schema with all tables
- implementation-plan.md: 12-phase implementation guide
- RUNNING.md: deployment and troubleshooting guide
- README.md: project overview
Family profile: 2 adults, 2 children. Mushroom avoidance for 3/4.
Approval workflow: email proposals, one denial swaps meal.
Tech stack: FastAPI, PostgreSQL, React, Playwright, SendGrid."
Important Conventions
Code Style
- Python: Black formatter, isort for imports
- TypeScript: Prettier, ESLint
- No comments unless explaining non-obvious logic
Git Commits
- Conventional commits:
feat:,fix:,docs:,refactor:,test: - One logical change per commit where possible
API Design
- RESTful endpoints with proper HTTP methods and status codes
- Pydantic schemas for request/response validation
- JWT-free for MVP (simple token-based auth for email approval links)
Database
- Always use UUIDs for primary keys
- Timestamps with timezone (TIMESTAMPTZ)
- Soft deletes preferred over hard deletes where applicable
Testing
- Write unit tests for services (pytest)
- Integration tests for API endpoints
- Frontend: component tests with React Testing Library
Common Tasks
Run full stack
docker-compose up -d
Create database migration
docker-compose exec backend alembic revision --autogenerate -m "description"
Trigger scrape manually
curl -X POST http://localhost:8000/api/admin/scrape \
-H "Content-Type: application/json" \
-d '{"source": "lucky_california", "type": "weekly_ad"}'
View all logs
docker-compose logs -f
Known Issues / Open Questions
- Lucky California scraping: May need adjustment if website structure changes. Has fallback to manual input.
- AI image generation: Config flag to enable/disable. Disabled by default.
- WhatsApp integration: Planned for future via Twilio. Out of scope for MVP.
Contact / Context
- Primary user: Peter (tech-savvy, hosts the system)
- Wife: Non-technical, will use web UI and email
- Children: 2, eating habits vary (one OK with mushrooms)
Last updated: 2026-05-04 (after documentation completion)