This repository contains two separate applications:
client/— React frontend (TanStack Start, Vite, Bun)backend/— Rust API (Axum, SQLx, PostgreSQL)
The frontend calls the Rust API through TanStack Start server functions for catalog, account, cart, and checkout operations. Sign-in is required for cart and orders. The backend remains the source of product and order data.
- Rust (stable)
- Docker & Docker Compose
- Bun (for the frontend)
- SQLx CLI:
cargo install sqlx-cli --no-default-features --features postgres
# 1. Copy the env template and fill in your secrets
cp .env.example .env
# 2. Start the database, run migrations, and launch both servers
make devThat's it. The API listens on http://127.0.0.1:8000 and the frontend dev server on http://localhost:3000.
| Target | Description |
|---|---|
make db |
Start Postgres via Docker Compose |
make db-stop |
Stop Postgres |
make migrate |
Run SQLx migrations |
make seed |
Seed the catalogue with demo products |
make backend |
Start the Rust API |
make client |
Start the Vite dev server |
make dev |
Start DB + migrations + backend + client together |
make test |
Run backend tests |
make fmt |
Check Rust formatting |
make clippy |
Run clippy lints |
make lint |
Run all quality checks (fmt + clippy + tests) |
make sqlx-prepare |
Regenerate the .sqlx offline cache (commit it!) |
If you prefer not to use make, run backend commands from backend/ so the API can find configuration.yaml, the SQLx offline cache, and the migrations:
docker compose up -d # Start Postgres
cd backend
DATABASE_URL=postgres://postgres:password@localhost:5432/electronics_shopping_api \
cargo sqlx migrate run # Run migrations
cargo run # Start the APIFor the frontend:
cd client
bun install --frozen-lockfile
bun run devSet API_BASE_URL and SESSION_SECRET for the client server (see client/.env.example). The API must be reachable from that server. The UI displays prices as USD; checkout places a pending order without processing payment.