Update README: Phase 2 complete, API docs, file structure
This commit is contained in:
@@ -5,7 +5,7 @@ A custom Django app for pantry tracking, meta-recipes, and meal planning. Built
|
|||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
- **Django 5.2** (latest LTS) with SQLite backend
|
- **Django 5.2** (latest LTS) with SQLite backend
|
||||||
- **Django REST Framework** for API (Phase 2)
|
- **Django REST Framework** for API with token auth
|
||||||
- **HTMX** frontend planned (Phase 4)
|
- **HTMX** frontend planned (Phase 4)
|
||||||
- **App name:** `kitchen`
|
- **App name:** `kitchen`
|
||||||
|
|
||||||
@@ -54,12 +54,36 @@ python manage.py createsuperuser
|
|||||||
python manage.py runserver 0.0.0.0:8042
|
python manage.py runserver 0.0.0.0:8042
|
||||||
```
|
```
|
||||||
|
|
||||||
Admin UI at: `http://localhost:8042/admin/`
|
## Access
|
||||||
|
|
||||||
## Credentials
|
- **Admin UI:** `http://localhost:8042/admin/`
|
||||||
|
- **Browsable API:** `http://localhost:8042/api/`
|
||||||
|
- **cgit:** `https://git.jihakuz.xyz/food/`
|
||||||
|
|
||||||
- **Admin user:** `tom`
|
## API
|
||||||
- **Admin password:** `Kitch3n!2026`
|
|
||||||
|
All endpoints require auth. Token auth for Caine, session auth for browser.
|
||||||
|
|
||||||
|
### Key Endpoints
|
||||||
|
|
||||||
|
| Method | Endpoint | Purpose |
|
||||||
|
|--------|----------|---------|
|
||||||
|
| GET | `/api/what-can-i-cook/?servings=2` | Match pantry vs recipes |
|
||||||
|
| POST | `/api/log-cook/` | Log a cooked meal, optionally deduct from pantry |
|
||||||
|
| GET | `/api/pantry/` | List all pantry items |
|
||||||
|
| GET | `/api/pantry/expiring/` | Items expiring within 3 days |
|
||||||
|
| GET | `/api/pantry/restock/` | Staples needing restocking |
|
||||||
|
| CRUD | `/api/ingredients/` | Ingredient master list |
|
||||||
|
| CRUD | `/api/meta-recipes/` | Meta-recipes with nested slots |
|
||||||
|
| CRUD | `/api/recipes/` | Fixed recipes |
|
||||||
|
| CRUD | `/api/shopping-list/` | Shopping list |
|
||||||
|
| CRUD | `/api/cook-log/` | Cooking history |
|
||||||
|
|
||||||
|
### Auth
|
||||||
|
|
||||||
|
- **Token:** `Authorization: Token <token>` header
|
||||||
|
- **Session:** Log in via admin or `/api-auth/login/`
|
||||||
|
- **API users:** `tom` (admin), `caine` (API-only)
|
||||||
|
|
||||||
## File Structure
|
## File Structure
|
||||||
|
|
||||||
@@ -70,8 +94,11 @@ Admin UI at: `http://localhost:8042/admin/`
|
|||||||
│ ├── urls.py
|
│ ├── urls.py
|
||||||
│ └── wsgi.py
|
│ └── wsgi.py
|
||||||
├── kitchen/ # Main app
|
├── kitchen/ # Main app
|
||||||
│ ├── models.py # All models
|
│ ├── models.py # All 11 models
|
||||||
│ ├── admin.py # Admin config with inlines
|
│ ├── admin.py # Admin config with inlines
|
||||||
|
│ ├── serializers.py # DRF serializers
|
||||||
|
│ ├── views.py # ViewSets + what-can-i-cook + log-cook
|
||||||
|
│ ├── urls.py # API router
|
||||||
│ ├── management/
|
│ ├── management/
|
||||||
│ │ └── commands/
|
│ │ └── commands/
|
||||||
│ │ └── seed.py # Initial data seeder
|
│ │ └── seed.py # Initial data seeder
|
||||||
@@ -79,6 +106,7 @@ Admin UI at: `http://localhost:8042/admin/`
|
|||||||
├── venv/ # Python virtual environment (gitignored)
|
├── venv/ # Python virtual environment (gitignored)
|
||||||
├── db.sqlite3 # SQLite database (gitignored)
|
├── db.sqlite3 # SQLite database (gitignored)
|
||||||
├── manage.py
|
├── manage.py
|
||||||
|
├── requirements.txt
|
||||||
└── README.md
|
└── README.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -89,17 +117,26 @@ Admin UI at: `http://localhost:8042/admin/`
|
|||||||
- **Staples** (onions, frozen chips, salt, etc.) → auto-flag for restocking when quantity = 0
|
- **Staples** (onions, frozen chips, salt, etc.) → auto-flag for restocking when quantity = 0
|
||||||
- **Onions** are a permanent staple — always restock
|
- **Onions** are a permanent staple — always restock
|
||||||
- **Chicken skin** → remove before cooking (noted in slot option notes)
|
- **Chicken skin** → remove before cooking (noted in slot option notes)
|
||||||
- **Tom prefers pork to chicken** — pork mince over loins
|
- **Tom prefers pork** to chicken — pork mince over loins
|
||||||
|
- **Cooked chicken** — 3 day max fridge life
|
||||||
|
- **Defrosted sausages** — 2-3 days max
|
||||||
|
|
||||||
## Implementation Phases
|
## Implementation Phases
|
||||||
|
|
||||||
- [x] **Phase 1:** Django project + models + admin + seed data
|
- [x] **Phase 1:** Django project + models + admin + seed data
|
||||||
- [ ] **Phase 2:** DRF API + Caine integration + "what can I cook?" logic
|
- [x] **Phase 2:** DRF API + token auth + "what can I cook?" + log-cook with pantry deduction
|
||||||
- [ ] **Phase 3:** Recipe import (URL scraping + cookbook extraction)
|
- [ ] **Phase 3:** Recipe import (URL scraping + cookbook extraction)
|
||||||
- [ ] **Phase 4:** HTMX frontend (pantry view, recipe browser, shopping list)
|
- [ ] **Phase 4:** HTMX frontend (pantry view, recipe browser, shopping list)
|
||||||
- [ ] **Phase 5:** Systemd service + nginx reverse proxy + production hardening
|
- [ ] **Phase 5:** Systemd service + nginx reverse proxy + production hardening
|
||||||
|
|
||||||
|
## Caine Integration
|
||||||
|
|
||||||
|
OpenClaw skill file at `~/.openclaw/workspace/skills/food/SKILL.md` teaches Caine the API each session. Natural language interface via Matrix:
|
||||||
|
- "What can I cook?" → calls `/api/what-can-i-cook/`
|
||||||
|
- "Add 6 eggs to the fridge" → POST to `/api/pantry/`
|
||||||
|
- "Made stir fry with pork and noodles" → POST to `/api/log-cook/` with deduction
|
||||||
|
- [Photo of shopping] → identify items, bulk add to pantry
|
||||||
|
|
||||||
## Design Doc
|
## Design Doc
|
||||||
|
|
||||||
Full design document with meta-recipe concept, model rationale, and implementation plan:
|
Full design document: `Obsidian Vault/Tom Net/Meal Planning System.md`
|
||||||
`Obsidian Vault/Tom Net/Meal Planning System.md`
|
|
||||||
|
|||||||
Reference in New Issue
Block a user