---
description: Run all services via Docker Compose (for home network / clean environment)
---

## Docker Compose — All Services

Use this on a home network or CI where there is no corporate proxy.

### Prerequisites

- Docker Desktop running
- `.env` at repo root (Cosmos DB, JWT, Stripe, Azure credentials)
- `admin-dashboard-web/.env.local` (Cosmos DB, JWT)
- `user-dashboard-web/.env.local` (Cosmos DB, JWT)
- `tracker-dashboard-web/.env.local` (Cosmos DB, JWT)

### Start

```bash
docker compose up -d       # builds images + starts all 10 containers
docker compose ps          # check status
docker compose logs -f     # tail all logs
```

### Services

| Service           | Container           | Port     | Image / Dockerfile                                                |
| ----------------- | ------------------- | -------- | ----------------------------------------------------------------- |
| Loki              | `loki`              | 3100     | `grafana/loki:3.3.2`                                              |
| Grafana           | `grafana`           | 3000     | `grafana/grafana:11.4.0`                                          |
| Traefik Gateway   | `gateway`           | 80, 8080 | `traefik:v3.3`                                                    |
| Backend API       | `backend`           | 8000     | `backend/Dockerfile`                                              |
| Admin Dashboard   | `admin-dashboard`   | 3001     | `admin-dashboard-web/Dockerfile`                                  |
| User Dashboard    | `user-dashboard`    | 3002     | `user-dashboard-web/Dockerfile`                                   |
| Tracker Dashboard | `tracker-dashboard` | 3003     | `tracker-dashboard-web/Dockerfile`                                |
| Growth Service    | `growth-service`    | 4001     | `../learning_ai_common_plat/services/growth-service/Dockerfile`   |
| Billing Service   | `billing-service`   | 4002     | `../learning_ai_common_plat/services/billing-service/Dockerfile`  |
| Platform Service  | `platform-service`  | 4003     | `../learning_ai_common_plat/services/platform-service/Dockerfile` |
| Tracker Service   | `tracker-service`   | 4004     | `../learning_ai_common_plat/services/tracker-service/Dockerfile`  |

### Traefik Routing (port 80)

| PathPrefix                                                                                        | Routes to        |
| ------------------------------------------------------------------------------------------------- | ---------------- |
| `/api` (catch-all), `/health`                                                                     | Backend API      |
| `/api/invitations`, `/api/referrals`, `/api/promos`                                               | Growth Service   |
| `/api/subscriptions`, `/api/payments`, `/api/usage`, `/api/plans`, `/api/licenses`, `/api/stripe` | Billing Service  |
| `/api/auth`, `/api/audit`, `/api/notifications`, `/api/flags`, `/api/ratelimit`                   | Platform Service |
| `/api/items`, `/api/tracker`                                                                      | Tracker Service  |

### Stop

```bash
docker compose down
```

### Rebuild (after code changes)

```bash
docker compose build       # rebuild all images
docker compose up -d       # restart with new images
```

### Observability

- **Grafana**: http://localhost:3000 (admin / lysnrai)
- **Loki**: log aggregation — all services ship logs via Loki Docker driver
- **Traefik dashboard**: http://localhost:8080

### Notes

- Backend uses `python:3.13-slim`, dashboards use `node:20-alpine`, microservices use `node:22-alpine`
- All dashboards require `output: "standalone"` in `next.config.ts` (already set)
- All dashboards have `GET /api/health` for Docker healthchecks
- Env vars are injected via `env_file` in `docker-compose.yml`
- Do NOT use on corporate proxy networks (SSL interception breaks pip/npm installs inside Docker)
