Environnements
Dev, staging, production — configuration et déploiement
Environnements
| Env | URL | DB | Usage |
|---|---|---|---|
| dev | localhost:3001 (web) / localhost:3000 (api) | Docker local | Développement |
| staging | staging.wcare.fr | PostgreSQL dédié | Tests avant prod |
| production | app.wcare.fr | PostgreSQL prod | Utilisateurs réels |
Variables d'environnement
Server (apps/server/.env)
| Variable | Dev | Prod | Description |
|---|---|---|---|
DATABASE_URL | postgresql://postgres:password@localhost:5432/wcare | Secret | Connexion PostgreSQL |
BETTER_AUTH_SECRET | Généré localement | Secret (32+ chars) | Secret de session |
BETTER_AUTH_URL | http://localhost:3000 | https://api.wcare.fr | URL du serveur auth |
CORS_ORIGIN | http://localhost:3001 | https://app.wcare.fr | Origine autorisée |
RESEND_API_KEY | Key de test | Key de prod | API Resend pour emails |
WHATSAPP_TOKEN | — | Secret | Token WhatsApp Business API |
WHATSAPP_PHONE_ID | — | Secret | Phone number ID Meta |
Web (apps/web/.env)
| Variable | Dev | Prod |
|---|---|---|
NEXT_PUBLIC_SERVER_URL | http://localhost:3000 | https://api.wcare.fr |
Déploiement
Infrastructure cible
Dokploy (Proxmox VM)
├── Traefik (reverse proxy, SSL auto)
├── wcare-web (Next.js, port 3001)
├── wcare-api (Elysia/Bun, port 3000)
└── wcare-db (PostgreSQL, port 5432)Scripts
bun dev # Web + Server en parallèle
bun build # Build tous les packages
bun db:start # Docker up PostgreSQL
bun db:push # Push schema Drizzle
bun db:studio # Drizzle Studio (GUI)
bun db:migrate # Run migrationsCI/CD (GitHub Actions)
À mettre en place.
Pipeline cible :
- Lint —
biome check - Type-check —
bun run check-types - Build —
bun run build - Deploy — Push vers Dokploy (staging ou prod selon la branche)