Backend API
Getting Started
Running the Cookest Rust API locally
Getting Started
Prerequisites
| Tool | Minimum version | Install |
|---|---|---|
| Rust | 1.78+ | rustup update stable |
| 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";Setup
# 1. Enter the api directory
cd api
# 2. Copy environment template
cp .env.example .env
# Edit .env β at minimum set DATABASE_URL and JWT_SECRET
# 3. Create the database
createdb cookest
# 4. Start the server (runs migrations automatically)
cargo run
# Server starts on http://0.0.0.0:8080Build for production
cargo build --release
./target/release/cookest-apiDocker (optional)
FROM rust:1.78-slim as builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim
COPY --from=builder /app/target/release/cookest-api /usr/local/bin/
CMD ["cookest-api"]Verifying the server
curl http://localhost:8080/api/ingredients?q=chicken
# Returns a JSON array of matching ingredientsDevelopment tips
- Hot reload: Install
cargo-watch(cargo install cargo-watch) and runcargo watch -x run - Logs: Set
RUST_LOG=debugin your.envfor verbose output - Migrations: Run on every
cargo runβ safe to restart freely