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 |
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 |
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 |
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 |
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