Backend APIs
Environment Variables
All configuration variables for the Cookest Food API and App API
Environment Variables
Copy .env.example to .env and fill in the required values.
cp .env.example .envFood API
| Variable | Default | Description |
|---|---|---|
FOOD_DATABASE_URL | DATABASE_URL fallback | PostgreSQL connection string for the Food API |
FOOD_HOST | 0.0.0.0 | Bind address |
FOOD_PORT | 8081 | HTTP port |
FOOD_CORS_ORIGIN | * | Allowed CORS origin |
FOOD_DATA_SOURCE | auto | local, fatsecret, or hybrid — see below |
FS_CLIENT_ID | optional | FatSecret OAuth client ID (needed for fatsecret/hybrid) |
FS_CLIENT_SECRET | optional | FatSecret OAuth client secret |
FOOD_DATA_SOURCE auto-selection: If FS credentials are present and no explicit value is set → hybrid. If credentials are absent → local. Setting fatsecret or hybrid without credentials causes a startup error.
App API
| Variable | Default | Description |
|---|---|---|
APP_DATABASE_URL | DATABASE_URL fallback | PostgreSQL connection string for the App API |
JWT_SECRET | required | JWT signing key — minimum 32 characters |
SELF_HOSTED | false | true unlocks all Pro features and registers new users as Pro tier |
HOST | 127.0.0.1 | Bind address |
PORT | 8080 | HTTP port |
CORS_ORIGIN | http://localhost:3000 | Allowed CORS origin |
JWT_ACCESS_EXPIRY_SECONDS | 900 | Access token TTL (15 minutes) |
JWT_REFRESH_EXPIRY_SECONDS | 604800 | Refresh token TTL (7 days) |
OLLAMA_URL | http://localhost:11434 | Ollama API base URL |
OLLAMA_MODEL | llama3.1:8b | Primary Ollama model for chat and recipe generation |
OLLAMA_VISION_MODEL | qwen2.5vl:7b | Vision model for receipt/barcode OCR |
OLLAMA_VISION_TIMEOUT_SECS | 120 | Timeout for vision inference — increase for CPU |
OLLAMA_EMBED_MODEL | nomic-embed-text | Embeddings model for RAG |
PDF_UPLOAD_DIR | ./cookest_pdfs | Writable directory for uploaded PDFs |
STRIPE_WEBHOOK_SECRET | optional | Stripe webhook signing secret (whsec_...) |
FOOD_API_URL | http://localhost:8081 | Food API base URL |
FOOD_API_KEY | optional | API key used for Food API write requests |
IMAGE_GEN_URL | required for image gen | URL of the Python image-gen microservice |
IMAGE_GEN_TOKEN | optional | Bearer token for image-gen service (added server-side) |
RESEND_API_KEY | optional | Resend email API key |
RESEND_FROM_EMAIL | noreply@m.cookest.app | From address for outbound email |
OVERPASS_URL | OSM default | OpenStreetMap Overpass endpoint for nearby store lookups |
RAG_TOP_K | 5 | Number of knowledge chunks retrieved per RAG query |
Security notes
Never commit your .env file. The .gitignore already excludes it. In production, inject secrets via environment variables or a secrets manager — never via a committed file.
FOOD_DATABASE_URLandAPP_DATABASE_URLcan both fall back toDATABASE_URLfor local monolith-style runsJWT_SECRETmust be at least 32 characters of random data (openssl rand -hex 32)STRIPE_WEBHOOK_SECRETstarts withwhsec_— obtain from the Stripe dashboard- Use dedicated database users for the Food API and App API in production