Monorepo containing three applications:
- API (
src/backend) — .NET 10 backend with Clean Architecture - Web (
src/web) — Next.js 16 dispatcher UI with NextAuth v5 - Mobile (
src/mobile) — Expo driver app
# 1. Copy the environment template (required for docker-compose variable interpolation)
cp .env.example .env
# 2. Generate a NextAuth secret
# Run: openssl rand -base64 32
# Then paste the result as AUTH_SECRET in .env
# 3. Start all services
docker compose up --buildNote: Docker Compose automatically loads
.envfor variable interpolation (${VAR}). The file is gitignored so secrets don't get committed. The template is.env.example.
All services will be available at:
- Web UI: http://localhost
- API: http://localhost/api
- Swagger: http://localhost/swagger
- Hangfire: http://localhost/hangfire
- Seq Logs: http://localhost/seq
All environment variables are defined in .env.example. This file is a template — copy it to .env and fill in actual values.
.env.exampleis the template (committed to git, contains placeholder values).envis your private config (NOT committed, contains real values)- Docker Compose automatically reads
.envfor${VAR}interpolation - The web service
env_file: .envpasses runtime vars to the container
Next.js bakes NEXT_PUBLIC_* variables into the JavaScript bundle at build time, not runtime. This means:
- They must be present when
npm run buildruns inside the Docker build - Changes to these vars require a rebuild:
docker compose up --build
For local development, NEXT_PUBLIC_API_URL should point to http://localhost. In production, update it to your public domain.
The web app uses two different URLs to reach the API:
| Variable | Used By | Purpose | Docker Value | Local Dev Value |
|---|---|---|---|---|
NEXT_PUBLIC_API_URL |
Browser (client-side) | Browser makes API calls through Caddy | http://localhost |
http://localhost |
API_INTERNAL_URL |
Next.js server (NextAuth authorize) | Server-side calls to OpenIddict token endpoint | http://api:8080 |
http://localhost:8080 |
In Docker, the web container cannot use localhost to reach the API (it reaches itself). Use the Docker service name api:8080 for internal communication.
Modify .env (not .env.example). Rebuild to apply changes that affect the web app:
docker compose up --buildFor API-only changes (connection strings, secrets, etc.), you can restart just the API container:
docker compose restart apiNote: Some containers have init scripts that run only once (e.g., Seq sets its admin password on first run, PostgreSQL initializes data directory). For changes to affect these containers, you must delete their volumes and recreate:
docker compose down -v && docker compose up --buildThe
-vflag removes volumes (pgdata,seqdata). Use this when changing Seq password or resetting the database.
After first startup, the API seeds an admin user:
- Username:
admin - Email:
admin@lastmile.com - Password:
Admin@123
cd src/backend
dotnet restore
dotnet build --no-restore
dotnet run --project src/LastMile.TMS.Apicd src/web
# For local dev, create .env.local with API_INTERNAL_URL pointing to API on host:
echo "API_INTERNAL_URL=http://localhost:8080" > .env.local
npm ci
npm run devNote: When running
npm run devlocally, setAPI_INTERNAL_URL=http://localhost:8080in.env.localso NextAuth can reach the API directly (bypassing Caddy).
pgadmin is available at http://localhost:5050 for now it should be used only for development.
pgadmin container is enabled by compose profile dev, set by COMPOSE_PROFILES=dev in .env file. Remove or unset this env to disable pgadmin in production (container won't be created).
initial setup:
- right click on
Servers - choose
Register - choose
Server - fill out
Name - select
Connectiontab - fill host name/address
postgresand passwordpostgres(default values from .env.example)
done, now you can
- go to
Servers - select your server name
- select
Databases - select
lastmile_tms - select
Schemas - select
public - select
Tables
or just click Tools, PSQL tool and write \dt to list all tables.
See CLAUDE.md for detailed architecture documentation.