- Développement : HTTP simple (
http://localhost:3000) - Production : HTTPS avec Let's Encrypt via nginx
# Créer le fichier .env.production avec vos vraies variables
cp .env .env.production
# Éditer .env.production avec les bonnes valeurs (DB_PASSWORD, JWT_SECRET, etc.)# Remplacer par votre vraie domaine et email
./scripts/init-letsencrypt.sh api.mondomaine.com admin@mondomaine.comdocker compose -f docker-compose.prod.yml up -d- HTTP → Redirection automatique vers HTTPS
- HTTPS :
https://votre-domaine.com - Documentation :
https://votre-domaine.com/api
docker-compose.prod.yml- Stack complète avec nginx + Let's Encryptnginx/nginx.conf- Configuration nginx HTTPSscripts/init-letsencrypt.sh- Script d'initialisation SSL
# Base de données
DB_HOST=db
DB_USERNAME=postgres
DB_PASSWORD=votre_mot_de_passe_securise
DB_DATABASE=bots-api
# JWT
JWT_SECRET=votre_secret_jwt_super_securise
# Discord
DISCORD_CLIENT_ID=votre_client_id
DISCORD_CLIENT_SECRET=votre_client_secret
DISCORD_REDIRECT_URI=https://votre-domaine.com/auth/callback
ALLOWED_GUILD_ID=votre_guild_id
DISCORD_BOT_TOKEN=votre_bot_tokenLe container certbot se charge automatiquement du renouvellement des certificats tous les 12h.
docker compose -f docker-compose.dev.yml up -d
# API accessible sur http://localhost:3000chmod +x scripts/generate-ssl-certs.sh
./scripts/generate-ssl-certs.shdocker compose -f docker-compose.dev.yml up -ddocker compose -f nginx-proxy.yml up -d- HTTP (redirige vers HTTPS) : http://localhost:8080
- HTTPS : https://localhost:8443
- API directe (développement) : http://localhost:3000
Les certificats sont auto-signés pour le développement. Votre navigateur affichera un avertissement de sécurité que vous pouvez ignorer en développement.
Requête HTTPS → Nginx (8443) → API Docker (3000)
nginx-proxy.yml- Configuration Docker pour nginxnginx/nginx-simple.conf- Configuration nginx HTTPSscripts/generate-ssl-certs.sh- Génération certificats dev