Skip to content

ubahmapk/food-picker-rs

Repository files navigation

Food Picker

A fast, lightweight web app to randomly select a restaurant from curated lists. Perfect for family meal decisions.

Live at: eat.starfleet.top

Quick Start

Local Development

PLACES_FILE=./places.toml cargo run

Visit http://localhost:8000.

macOS note: Port 5000 is used by AirPlay Receiver. Always use port 8000 (the default) for local dev.

Docker

docker compose up

Mounts ./places.toml into the container. The app listens on port 8000.

API Reference

All endpoints return JSON. Use curl directly if you prefer.

Pick a restaurant

curl "https://eat.starfleet.top/api/pick"
curl "https://eat.starfleet.top/api/pick?categories=Fast+Food"
curl "https://eat.starfleet.top/api/pick?categories=Fast+Food&vetoed=McDonalds&vetoed=Wendy's"

Response: {"name": "Whataburger"} or {"error": "no options remaining"} (HTTP 409)

Manage places

# List all places
curl https://eat.starfleet.top/api/places

# Add a place
curl -X POST https://eat.starfleet.top/api/places \
  -H "Content-Type: application/json" \
  -d '{"name": "Taco Bell", "categories": ["Fast Food"]}'

# Delete a place
curl -X DELETE "https://eat.starfleet.top/api/places/Taco%20Bell"

# Update a place
curl -X PUT "https://eat.starfleet.top/api/places/McDonalds" \
  -H "Content-Type: application/json" \
  -d '{"categories": ["Fast Food", "Quality Nommings"]}'

Manage categories

# List all categories
curl https://eat.starfleet.top/api/categories

# Add a category
curl -X POST https://eat.starfleet.top/api/categories \
  -H "Content-Type: application/json" \
  -d '{"name": "Fancy Fixings"}'

# Delete a category (removes it from all places)
curl -X DELETE "https://eat.starfleet.top/api/categories/Fancy%20Fixings"

# Rename a category (cascades to all places)
curl -X PUT "https://eat.starfleet.top/api/categories/Fancy%20Fixings" \
  -H "Content-Type: application/json" \
  -d '{"name": "Fancy Fare"}'

# Reorder categories
curl -X PUT https://eat.starfleet.top/api/categories \
  -H "Content-Type: application/json" \
  -d '{"categories": ["Quality Nommings", "Fast Food", "Fancy Fixings"]}'

Import / Export

# Export as TOML
curl https://eat.starfleet.top/api/export?format=toml > places.toml

# Export as JSON
curl https://eat.starfleet.top/api/export?format=json > places.json

# Import from TOML or JSON
curl -X POST https://eat.starfleet.top/api/import \
  -F "file=@places.toml"

Web UI

  • Home → Select categories, pick a restaurant, veto for another, or accept
  • Manage → Add/delete places and categories, import/export data

Mobile-optimized via Pico CSS.

Development

# Run tests
cargo test

# Format
cargo fmt

# Lint
cargo clippy -- -D warnings

# Run locally
PLACES_FILE=./places.toml cargo run

Releasing

Releases are driven by git tags and handled automatically by CI:

git tag v1.0.0
git push origin v1.0.0

The release workflow builds a Docker image and pushes it to ghcr.io/ubahmapk/food-picker-rs with tags 1.0.0, 1.0, 1, and latest.

See CHANGELOG.md for release history.

Architecture

  • Backend: Axum (Rust) + Tokio async runtime
  • Serialization: Serde + serde_json
  • Frontend: Vanilla JS SPA (no build step, no frameworks)
  • Data: TOML file (atomic writes for safety)
  • Reverse proxy: Caddy (auto Let's Encrypt HTTPS)

License

MIT © 2026 Jon Mark Allen

About

Randomly pick a restaurant from curated lists. Rust/Axum port.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors