Backend APIs
Getting Started
Running the Cookest Food API and App API locally
Getting Started
Prerequisites
| Tool | Minimum version | Install |
|---|---|---|
| Rust | 1.78+ | rustup update stable |
| Docker + Compose | latest | docker.com |
| PostgreSQL | 15+ | postgresql.org |
| Ollama | latest | ollama.ai (optional — for AI features) |
| poppler | latest | brew install poppler / apt install poppler-utils (optional — for PDF pipeline) |
PostgreSQL extensions required:
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";What runs where
| Service | Port | Purpose |
|---|---|---|
| Food API | 8081 | Ingredient and recipe catalog service |
| App API | 8080 | Authenticated app backend, meal planning, inventory, chat, and payments |
Recommended setup: Docker Compose
This starts the databases and both Rust services together.
cd api
docker compose up --buildThe compose file creates:
food-dbon port5432app-dbon port5433food-apion port8081app-apion port8080
Run with Cargo
If you prefer running the binaries directly, start Postgres first and then run each service in its own terminal.
cd api
cp .env.example .env
# Fill in FOOD_DATABASE_URL, APP_DATABASE_URL, JWT_SECRET, and FOOD_API_URL# Terminal 1
cargo run -p cookest-food-api
# Terminal 2
cargo run -p cookest-app-apiIf you are not using Docker, create the two databases first:
createdb cookest_food
createdb cookest_appBuild for production
cargo build -p cookest-food-api --release
cargo build -p cookest-app-api --releaseDocker images individually
docker build -f crates/food-api/Dockerfile -t cookest-food-api .
docker build -f crates/app-api/Dockerfile -t cookest-app-api .Verifying the services
curl http://localhost:8081/health
curl http://localhost:8080/healthDevelopment tips
- Hot reload: Install
cargo-watch(cargo install cargo-watch) and runcargo watch -x 'run -p cookest-food-api'orcargo watch -x 'run -p cookest-app-api'in separate terminals - Logs: Set
RUST_LOG=debugin your.envfor verbose output - Migrations: Run automatically on startup for both services