Installation
Prerequisites
Section titled “Prerequisites”| Tool | Version | Notes |
|---|---|---|
| Rust | 1.85+ | Install via rustup |
| Docker | 24+ | For PostgreSQL + PostGIS |
| Docker Compose | v2+ | Included with Docker |
| Trunk | latest | cargo install trunk (for Leptos WASM builds) |
| sqlx-cli | 0.7+ | cargo install sqlx-cli (for manual migrations) |
| Node.js | 20+ | Optional, for tooling |
Optional
Section titled “Optional”| Tool | Purpose |
|---|---|
| Nix + direnv | Reproducible dev shell |
| cargo-deny | Dependency auditing |
| cargo-llvm-cov | Code coverage |
| gitleaks | Secret scanning |
Clone and Start
Section titled “Clone and Start”git clone https://forgejo.wyattau.com/BlocMarket/BlocMarket_app.gitcd BlocMarket_app/bloc_marketStart the Database
Section titled “Start the Database”docker compose up -d dbThis starts PostgreSQL 16 with PostGIS. The container’s port 5432 is host-mapped to 5434:
| Service | Host Port | Container Port |
|---|---|---|
| PostgreSQL 16 + PostGIS | 5434 | 5432 |
| Redis 7 | 6380 | 6379 |
| API (Axum) | 8090 (local dev) | 3000 (Docker) |
| Frontend (Trunk) | 8080 | — |
Run Migrations
Section titled “Run Migrations”Migrations are applied automatically on API startup. To run them manually:
DATABASE_URL=postgres://postgres:postgres@localhost:5434/bloc_market sqlx migrate runOr generate offline metadata so builds don’t require a live database:
../scripts/generate-sqlx-offline.shexport SQLX_OFFLINE=truecargo build --workspaceRun the API
Section titled “Run the API”cargo run -p bloc-apiThe API starts on http://localhost:8090. Watch the logs for:
Running migrations...Applied N migrationsListening on 0.0.0.0:8090Verify with:
curl http://localhost:8090/healthcurl http://localhost:8090/health/dbcurl http://localhost:8090/health/rediscurl http://localhost:8090/readyRun the Web Frontend
Section titled “Run the Web Frontend”In a separate terminal:
trunk serve --open apps/webThis compiles the Leptos WASM frontend and serves it on http://localhost:8080.
Environment Variables
Section titled “Environment Variables”The local environment is configured in bloc_market/.env (git-ignored). Key variables:
| Variable | Required | Notes |
|---|---|---|
DATABASE_URL | Yes | postgres://postgres:postgres@localhost:5434/bloc_market for local Docker |
REDIS_URL | Yes | Default redis://127.0.0.1:6380 |
JWT_SECRET | Yes | Minimum 32 characters — generate with openssl rand -base64 48 |
JWT_EXPIRATION | No | Default 24h |
CORS_ALLOWED_ORIGINS | Yes | Comma-separated. Include http://localhost:8080 |
SMTP_HOST / SMTP_PORT / SMTP_USERNAME / SMTP_PASSWORD | Recommended | Required for email verification |
STRIPE_SECRET_KEY | No | Leave unset for stub mode |
RUST_LOG | No | Default info |
See the Deployment guide for the full reference.