summaryrefslogtreecommitdiff
path: root/README.md
blob: 956dda1d06ed67b84430d40ad0870209e4656f80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Food — Meal Planning System

A custom Django app for pantry tracking, meta-recipes, and meal planning. Built for Tom, operated primarily through Caine (OpenClaw AI assistant) via Matrix chat, with Django admin as the web UI.

## Architecture

- **Django 5.2** (latest LTS) with SQLite backend
- **Django REST Framework** for API (Phase 2)
- **HTMX** frontend planned (Phase 4)
- **App name:** `kitchen`

### Core Concept: Meta-Recipes

Instead of rigid recipes, the system uses **templates with swappable slots**:

```
"Stir Fry" = protein (chicken OR pork) + carb (noodles OR rice) + veg (any combo) + sauce
```

This matches how Tom actually cooks — same method, different ingredients depending on what's in the pantry.

## Models

| Model | Purpose |
|-------|---------|
| `Tag` | Flexible ingredient tags (protein, carb, veg, etc.) |
| `Ingredient` | Master ingredient list with aliases and shelf life |
| `PantryItem` | Current kitchen inventory with location and expiry |
| `MetaRecipe` | Cooking template with swappable slots |
| `Slot` | A category in a meta-recipe (protein, carb, veg) |
| `SlotOption` | An ingredient that can fill a slot, with qty/serving |
| `MetaRecipeBase` | Always-needed ingredients (onion, garlic, oil) |
| `Recipe` | Traditional fixed-ingredient recipe |
| `RecipeIngredient` | Ingredient in a fixed recipe |
| `CookLog` | What was cooked and when |
| `ShoppingListItem` | Shopping list with reasons and checkboxes |

## Setup

```bash
cd /var/lib/food
source venv/bin/activate

# Run migrations
python manage.py migrate

# Seed initial data (ingredients, pantry, meta-recipes)
python manage.py seed

# Create superuser (if not already done)
python manage.py createsuperuser

# Run dev server
python manage.py runserver 0.0.0.0:8042
```

Admin UI at: `http://localhost:8042/admin/`

## Credentials

- **Admin user:** `tom`
- **Admin password:** `Kitch3n!2026`

## File Structure

```
/var/lib/food/
├── food_project/          # Django project config
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── kitchen/               # Main app
│   ├── models.py          # All models
│   ├── admin.py           # Admin config with inlines
│   ├── management/
│   │   └── commands/
│   │       └── seed.py    # Initial data seeder
│   └── migrations/
├── venv/                  # Python virtual environment (gitignored)
├── db.sqlite3             # SQLite database (gitignored)
├── manage.py
└── README.md
```

## Pantry Business Rules

- **Freezer items** → no expiry date (frozen = indefinite)
- **Fridge items** → expiry date set from ingredient's `shelf_life_days` if available
- **Staples** (onions, frozen chips, salt, etc.) → auto-flag for restocking when quantity = 0
- **Onions** are a permanent staple — always restock
- **Chicken skin** → remove before cooking (noted in slot option notes)
- **Tom prefers pork to chicken** — pork mince over loins

## Implementation Phases

- [x] **Phase 1:** Django project + models + admin + seed data
- [ ] **Phase 2:** DRF API + Caine integration + "what can I cook?" logic
- [ ] **Phase 3:** Recipe import (URL scraping + cookbook extraction)
- [ ] **Phase 4:** HTMX frontend (pantry view, recipe browser, shopping list)
- [ ] **Phase 5:** Systemd service + nginx reverse proxy + production hardening

## Design Doc

Full design document with meta-recipe concept, model rationale, and implementation plan:
`Obsidian Vault/Tom Net/Meal Planning System.md`