You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Complete modular refactoring of FoodAI:
- Backend: Decoupled 'server.ts' into services (AI, Bring), database modules (connection, migrations), and shared utilities (units, categories).
- Frontend: Implemented custom hooks (useInventory, useCalendar, useRecipes, useSettings) to separate business logic from the view layer.
- Components: Broken down massive page components into smaller, reusable pieces (CategorySection, PackageItem).
- API: Centralized all backend communication in a type-safe API client.
- Stability: Fixed linting errors and added backend error logging to resolve inventory loading issues.
**Master your inventory. Discover your next meal.**
10
4
11
-
FoodAI is a self-hosted, AI-first kitchen inventory manager. It combines barcode scanning, computer vision, and generative AI to eliminate the friction of kitchen management — turning your pantry into an interactive culinary assistant.
5
+
FoodAI is a self-hosted, AI-first kitchen inventory manager. Version 2.0.0 introduces a modern, modular architecture with separated services, custom hooks, and a decoupled backend for improved performance and maintainability.
@@ -19,58 +13,30 @@ FoodAI has **no built-in authentication**. It is designed for trusted local netw
19
13
20
14
---
21
15
22
-
## ✨ Core Pillars
16
+
## ✨ Core Pillars (v2.0 Architecture)
23
17
24
18
### 📸 Zero-Friction Inventory
25
-
Forget manual data entry. Use **Vision Scan** to identify products and automatically extract expiry dates (MHD) directly from packaging. Whether it's a barcode lookup or a photo, the AI handles the logging.
19
+
Forget manual data entry. Use **Vision Scan** to identify products and automatically extract expiry dates (MHD) directly from packaging. Our refactored **AI Service** handles multi-provider logic (Gemini, OpenAI, Anthropic, Ollama) with robust error handling.
26
20
27
21
### 👨🍳 Generative Culinary Intelligence
28
-
FoodAI doesn't just list your food — it understands it. The **Generative Chef** analyzes your current stock and creates custom recipes and weekly meal plans tailored to what you have, prioritizing items nearing expiry.
22
+
FoodAI doesn't just list your food — it understands it. The **Generative Chef** analyzes your current stock and creates custom recipes and weekly meal plans. The v2.0 update includes a new **Mathematical Deduction Engine** for precise inventory tracking.
29
23
30
24
### 📱 Premium Mobile Experience (PWA)
31
-
Built for the modern kitchen. Fully installable **Progressive Web App** with smooth animations (Framer Motion) and a mobile-first UI that feels native on any device.
25
+
Built for the modern kitchen. Fully installable **Progressive Web App** with smooth animations (Framer Motion) and a mobile-first UI. The frontend has been refactored into modular components and custom hooks (`useInventory`, `useCalendar`) for a snappy user experience.
32
26
33
27
---
34
28
35
29
## 🚀 Features
36
30
37
-
-**Smart Dashboard** — Real-time overview of expiring items, opened packages, and today's planned meals
38
-
-**AI Barcode & Image Recognition** — Scan EAN/UPC barcodes or photograph any product for instant identification
39
-
-**Per-Package Inventory** — Each physical package tracked individually with open/closed status and fill level
40
-
-**Expiry (MHD) Scanning** — OCR via Tesseract.js with AI fallback to read best-before dates
41
-
-**AI Recipe Generation** — Single recipes or full weekly meal plans from your inventory
42
-
-**Extra Ingredients Toggle** — Optionally allow AI to suggest items you don't have
43
-
-**Favorite Recipes** — Save and reuse recipes without adding to calendar
44
-
-**Meal Calendar** — Plan meals, mark as cooked, auto-deduct ingredients
45
-
-**Smart Deduction** — Opens packages as needed, adjusts remaining amounts
46
-
-**Shopping List** — Auto-calculates missing ingredients for planned meals
47
-
-**Free Cook Mode** — Photograph ingredients on the counter, AI matches to inventory
48
-
-**Bring! Integration** — Send missing ingredients to the Bring! shopping list app
49
-
-**Mirror Display** — Dark-themed `/mirror/today` endpoint for smart mirror embedding
50
-
-**Multi-Language** — German, English, Spanish (more via community contributions)
51
-
-**Multi-AI Provider** — Switch providers in-app, no restart needed
52
-
-**Dark/Light/Custom Theme** — Switch between Light, Dark, and Custom themes in Settings. Custom theme supports uploading a CSS file.
53
-
-**Per-Item Price Tracking** — Each inventory item can have a price (EUR). Dashboard shows total stock value.
54
-
-**Storage Location** — Assign items to Vorratsschrank, Kuehlschrank, Gefrierschrank, Speisekammer, or Keller.
55
-
-**Minimum Stock Warnings** — Set a min_stock threshold per item. Dashboard shows low-stock count.
56
-
-**RSS Food Inspiration** — Dashboard sidebar shows daily recipe ideas from GuteKueche.de (DE) or BBC Good Food (EN), with TheMealDB fallback.
57
-
-**Live AI Model List** — Settings dropdown fetches available models from the provider's API (Gemini, OpenAI, Anthropic, DeepSeek, Moonshot, Ollama).
58
-
-**Security Improvements** — Rate limiting on AI endpoints, XSS protection, SSRF validation, masked secrets, non-root Docker container.
59
-
60
-
---
61
-
62
-
## 🧠 AI Providers
63
-
64
-
All configurable in the Settings page — API key, model selection, separate advisor model for cost optimization.
65
-
66
-
| Provider | Notes |
67
-
|----------|-------|
68
-
| Google Gemini | Any model (e.g. Gemini 3.1 Pro, 2.5 Flash). Enter model ID in Settings. |
69
-
| OpenAI | Any model (e.g. GPT-4.1, o3, o4-mini). Enter model ID in Settings. |
70
-
| Anthropic | Any model (e.g. Claude Opus 4.6, Sonnet 4.6). Enter model ID in Settings. |
71
-
| DeepSeek | Any model (e.g. deepseek-chat, deepseek-reasoner). Enter model ID in Settings. |
72
-
| Moonshot (Kimi) | Any model. Enter model ID in Settings. |
73
-
| Ollama (local) | Any locally pulled model (llama3, mistral, llava, etc.) |
31
+
-**Smart Dashboard** — Real-time overview of stock value, expiring items, and today's planned meals
32
+
-**Automatic Bring! Sync** — One-way background synchronization to your Bring! list
33
+
-**Bulk Management** — Move or delete multiple inventory items at once
34
+
-**AI Barcode & Image Recognition** — Scan EAN/UPC barcodes or photograph any product
35
+
-**Per-Package Inventory** — Each physical package tracked individually
36
+
-**AI Recipe Generation** — Single recipes or full weekly meal plans with custom portions per day
37
+
-**Storage Location Tracking** — Organize items by Fridge, Freezer, Pantry, etc.
38
+
-**Minimum Stock Warnings** — Automatic shopping list additions for staples
39
+
-**RSS Food Inspiration** — Daily recipe ideas from top food blogs
74
40
75
41
---
76
42
@@ -79,13 +45,11 @@ All configurable in the Settings page — API key, model selection, separate adv
Open **https://localhost:3000** and configure your AI provider in Settings.
109
73
110
-
### Local Development
111
-
112
-
```bash
113
-
npm install
114
-
cp .env.example .env.local
115
-
npm run dev
116
-
```
117
-
118
74
---
119
75
120
-
## 🐳 Docker
76
+
## 🐳 Docker & CI/CD
121
77
122
-
Pre-built multi-arch images (amd64 + arm64) are published to GitHub Container Registryon every release.
78
+
FoodAI uses **GitHub Actions** to automatically build and push multi-arch Docker images (`amd64` and `arm64`) to the GitHub Container Registry. This ensures a seamless experience on both standard servers and Raspberry Pi devices.
123
79
124
80
```yaml
125
81
services:
@@ -133,77 +89,24 @@ services:
133
89
- foodai-data:/app/data
134
90
env_file:
135
91
- .env
136
-
environment:
137
-
- DB_DIR=/app/data
138
-
- NODE_ENV=production
139
-
140
-
volumes:
141
-
foodai-data:
142
92
```
143
93
144
-
### HTTPS
145
-
146
-
FoodAI requires HTTPS for camera access on mobile. A self-signed certificate is auto-generated on first start. Accept the browser warning once, or mount your own certificates:
147
-
148
-
```yaml
149
-
volumes:
150
-
- ./certs/cert.pem:/app/data/server.cert:ro
151
-
- ./certs/key.pem:/app/data/server.key:ro
152
-
```
153
-
154
-
---
155
-
156
-
## ⚙️ Environment Variables
157
-
158
-
| Variable | Required | Default | Description |
159
-
|----------|----------|---------|-------------|
160
-
| `GEMINI_API_KEY` | No | — | Default Gemini API key (can also be set in-app) |
161
-
| `DB_DIR` | No | `./` | Directory for SQLite database and SSL certificates |
162
-
| `HTTP_PORT` | No | `3001` | Port for plain HTTP server (for iframe embedding) |
163
-
| `NODE_ENV` | No | — | Set to `production` to serve pre-built frontend |
164
-
165
-
---
166
-
167
-
## 🌍 Contributing Translations
168
-
169
-
FoodAI uses [react-i18next](https://react.i18next.com/). Translation files are in `src/i18n/locales/`.
170
-
171
-
To add a new language:
172
-
173
-
1. Copy `src/i18n/locales/en.json` to `src/i18n/locales/xx.json`
174
-
2. Translate all values (keep keys in English)
175
-
3. Add the import in `src/i18n/i18n.ts`
176
-
4. Add the language option to `src/pages/Settings.tsx`
177
-
5. Submit a PR!
178
-
179
94
---
180
95
181
-
## 📁 Project Structure
96
+
## 📁 Modular Project Structure (v2.0)
182
97
183
98
```
184
-
server.ts Express backend (API, AI, database)
99
+
server.ts Express application setup
100
+
server/
101
+
db/ Database connection & migrations
102
+
services/ AI, Bring!, and Prompt management
103
+
utils/ Unit conversions & category mapping
185
104
src/
186
-
i18n/ Internationalization
187
-
locales/ de.json, en.json, es.json
188
-
pages/ Dashboard, Inventory, Scanner, Recipes, Calendar, FreeCook, Settings, ShoppingList
0 commit comments