Backend (Rust/Axum): - pvm-api: Axum server with health and user profile endpoints, OpenAPI/Swagger UI, CORS, tracing, graceful shutdown - pvm-auth: JWT validation middleware with JWKS cache for offline-capable Zitadel token verification - pvm-core: Shared error types with IntoResponse impl - pvm-types: Shared domain types (UserProfile) Frontend (SvelteKit): - Dashboard app with Svelte 5 + TypeScript + Tailwind CSS v4 - Zitadel OIDC auth via @auth/sveltekit (PKCE flow) - Pages: landing, sign-in, dashboard, account settings - Responsive sidebar layout with dark mode support - Typed API client for backend communication Infrastructure: - Docker Compose dev environment with Zitadel v3, PostgreSQL 16, and DragonflyDB - Environment variable examples and setup documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
75 lines
2.2 KiB
Markdown
75 lines
2.2 KiB
Markdown
# PVM Docker Dev Environment
|
|
|
|
Local development stack with Zitadel auth, PostgreSQL, and DragonflyDB.
|
|
|
|
## Services
|
|
|
|
| Service | Description | Port |
|
|
|---------|-------------|------|
|
|
| **zitadel** | Zitadel v3 identity provider (OIDC/OAuth2) | 8080 |
|
|
| **zitadel-db** | PostgreSQL 16 for Zitadel (internal, not exposed) | — |
|
|
| **pvm-db** | PostgreSQL 16 for PVM application data | 5432 |
|
|
| **dragonfly** | DragonflyDB (Redis-compatible cache) | 6379 |
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Copy env file and adjust if needed
|
|
cp .env.example .env
|
|
|
|
# Start all services
|
|
docker compose -f docker-compose.dev.yml up -d
|
|
|
|
# Check status
|
|
docker compose -f docker-compose.dev.yml ps
|
|
|
|
# View Zitadel logs (first startup takes ~30-60s)
|
|
docker compose -f docker-compose.dev.yml logs -f zitadel
|
|
```
|
|
|
|
## Zitadel Admin Console
|
|
|
|
Once Zitadel finishes initializing (watch the logs for "server is listening"), open:
|
|
|
|
- **Console URL:** http://localhost:8080/ui/console
|
|
- **Username:** `admin`
|
|
- **Password:** value of `ZITADEL_ADMIN_PASSWORD` in your `.env` (default: `Admin1234!`)
|
|
|
|
## First-Time Zitadel Setup
|
|
|
|
After the first `docker compose up`, configure Zitadel for PVM:
|
|
|
|
1. **Log in** to the admin console at http://localhost:8080/ui/console
|
|
2. **Create a project** called "PVM"
|
|
3. **Create an application** within the project:
|
|
- Name: "PVM Web"
|
|
- Type: Web
|
|
- Auth method: PKCE (recommended for SvelteKit)
|
|
- Redirect URIs: `http://localhost:5173/auth/callback/zitadel`
|
|
- Post-logout URIs: `http://localhost:5173`
|
|
4. **Note the Client ID** — you'll need it for SvelteKit's `AUTH_ZITADEL_ID`
|
|
5. (Optional) **Configure social login** providers under Settings > Identity Providers:
|
|
- Google, Apple, Facebook — each requires an OAuth app from the respective developer console
|
|
|
|
## Connecting from the PVM Backend
|
|
|
|
```
|
|
# PostgreSQL (PVM app database)
|
|
DATABASE_URL=postgres://pvm:pvm-dev-password@localhost:5432/pvm
|
|
|
|
# DragonflyDB (Redis-compatible)
|
|
REDIS_URL=redis://localhost:6379
|
|
|
|
# Zitadel issuer (for OIDC/JWT validation)
|
|
ZITADEL_URL=http://localhost:8080
|
|
```
|
|
|
|
## Stopping & Cleanup
|
|
|
|
```bash
|
|
# Stop services (data is preserved in volumes)
|
|
docker compose -f docker-compose.dev.yml down
|
|
|
|
# Stop and delete all data (fresh start)
|
|
docker compose -f docker-compose.dev.yml down -v
|
|
```
|