Web apps

Meal-prep planner with weekly dinners and shopping lists

Subscription app that builds weekly five-dinner plans from stored recipes, with merged shopping lists, JSON export, a recipe editor, and per-user locale and

sveltekittypescriptsqlitebetter-sqlite3stripevitest

Built 1 time, downloaded 0 times.

Install from your terminal

Run this in your project folder. It signs you in, shows what changes and asks before it overwrites a file.

npx claude-lab add meal-prep-planner-with-weekly-dinners-and-shopping-lists-d7115a
10 filesDownload zip
CLAUDE.md
# Meal-prep planner

## Purpose
- Subscription app for busy parents. Every Sunday it builds a plan of 5 dinners, an aisle-grouped shopping list and a one-hour prep schedule.
- Plans use ONLY recipes stored in the database. Never invent recipes, ingredients or prices.
- The owner is a backend developer, strong in SQL and weaker in frontend. When you introduce a Svelte 5 rune, a `load` function or a form action, add one line explaining the choice.
- Prefer simple server-rendered pages with progressive enhancement.

## Stack
- SvelteKit with TypeScript and Svelte 5.
- better-sqlite3 with plain SQL migrations in `/migrations`. No ORM.
- Vitest for unit tests. Playwright for e2e at a 390px mobile viewport.
- Paraglide JS for UI messages, two locales at launch.
- Stripe for billing. zod validates all form input.
- Runes (`$state`, `$derived`) hold component state. `load` functions fetch data on the server before render. Form actions handle POST, so forms work without JavaScript.

## Commands
- `npm run dev`: start the dev server
- `npm run check`: svelte-check
- `npm run lint`: ESLint and Prettier checks
- `npm test`: Vitest unit tests
- `npm run test:e2e`: Playwright e2e tests
- `npm run build`: production build
- `npm run db:migrate`: apply SQL migrations
- `npm run db:seed`: insert seed data
- `npm run job:weekly`: run the weekly plan job

## Directory map
- `src/lib/server/db`: queries, one file per aggregate
- `src/lib/server/planner`: generator and swap logic
- `src/lib/server/shopping`: merge, convert and export
- `src/lib/units`, `src/lib/money`: pure helpers with unit tests
- `src/routes/(app)`: user pages
- `src/routes/admin`: recipe editor
- `src/routes/api/v1`: JSON endpoints

## Non-negotiable rules
- Money is integer minor units plus an ISO currency code. Never use floats.
- Quantities are stored in canonical metric (g, ml, count). Convert only for display.
- User-facing text goes through Paraglide messages. No hard-coded strings.
- Every user has locale, country, currency, unit_system and timezone columns.
- Base portion is 4 servings. Recipes scale by household size.
- Diet tags (vegetarian, nut-free, halal) are derived from ingredient flags (contains_meat, pork, alcohol, nuts, animal_product). Never hand-type them.
- The shopping list is derived from plan rows on read and never stored. Swapping one dinner needs no regeneration.
- Merge shopping items by ingredient_id plus canonical unit, then convert for display.
- The JSON export is versioned (`version: 1`) and documented in SPEC.md.
- The planner is deterministic given a seed. Filter diets and allergens in SQL. Respect the weekly budget. Avoid repeats from the last 4 weeks. Keep combined prep under 60 minutes. Each rule has a unit test.

## Gotchas
- Every SQLite connection needs `PRAGMA journal_mode=WAL` and `PRAGMA foreign_keys=ON`.
- Run the weekly job per user timezone, not server time.
- Stripe webhooks must verify the signature and be idempotent.
- The trial is 7 days.
- Never edit an applied migration. Use the add-migration skill.

## Security
- Never commit secrets. Real values stay in `.env`, which is never committed.
- `.env.example` holds placeholders only: `STRIPE_SECRET_KEY=YOUR_STRIPE_KEY`, `EMAIL_API_KEY=YOUR_EMAIL_KEY`.
- Admin routes check the role in `hooks.server.ts`.
- Every API endpoint checks ownership. Users read only their own plans and lists.

## Workflow
- Explore, plan, code, then run the `verify` skill before saying a task is done.
- Use `/clear` between unrelated tasks.
- Use the test-runner subagent (haiku) for long test output.
- Skills: `verify`, `shopping-list-rules` (loads for shopping and unit files), `add-migration`.
- Phase prompts are in PLAN.md. Read SPEC.md only when you need the product detail.
- A PostToolUse hook runs prettier on every edited file.

## Review rules
@REVIEW.md
Use for my project