Cookest
Backend APIs

Getting Started

Running the Cookest Food API and App API locally

Getting Started

Prerequisites

ToolMinimum versionInstall
Rust1.78+rustup update stable
Docker + Composelatestdocker.com
PostgreSQL15+postgresql.org
Ollamalatestollama.ai (optional — for AI features)
popplerlatestbrew 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

ServicePortPurpose
Food API8081Ingredient and recipe catalog service
App API8080Authenticated app backend, meal planning, inventory, chat, and payments

This starts the databases and both Rust services together.

cd api
docker compose up --build

The compose file creates:

  • food-db on port 5432
  • app-db on port 5433
  • food-api on port 8081
  • app-api on port 8080

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

If you are not using Docker, create the two databases first:

createdb cookest_food
createdb cookest_app

Build for production

cargo build -p cookest-food-api --release
cargo build -p cookest-app-api --release

Docker 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/health

Development tips

  • Hot reload: Install cargo-watch (cargo install cargo-watch) and run cargo watch -x 'run -p cookest-food-api' or cargo watch -x 'run -p cookest-app-api' in separate terminals
  • Logs: Set RUST_LOG=debug in your .env for verbose output
  • Migrations: Run automatically on startup for both services

On this page