Plateforme interne du Coding Club : gestion des sujets, inscriptions aux events, et espace membre.
| Couche | Technologie |
|---|---|
| Backend | Bun + Elysia |
| Base de données | PostgreSQL + Prisma |
| Frontend | React + TypeScript + Mantine, buildé avec Bun |
| Reverse proxy | Caddy (HTTPS automatique via Let's Encrypt) |
| Conteneurs | Docker + Docker Compose |
| Auth | Microsoft OAuth (Azure AD / @azure/msal-browser) |
- Prospects - catalogue de sujets filtrables avec ressources (PDFs, liens)
- Mantas - proposition de sujets, inscription aux events
- Admins - gestion des sujets, validation des propositions, whitelist, events
- Authentification via compte Epitech (Microsoft OAuth)
- Upload de PDFs, liens multiples par sujet
- Migrations Prisma automatiques au démarrage en prod
# Lancer la DB, le backend et le frontend en hot-reload
docker compose -f docker-compose.dev.yml up -d
# Appliquer les migrations et générer le client Prisma
cd backend && bunx prisma migrate devLe frontend est accessible sur http://localhost:6767, le backend sur http://localhost:8080.
Aucun .env n'est requis en dev - les variables sont codées en dur dans docker-compose.dev.yml.
Pour Prisma Studio :
cd backend && bunx prisma studio
git clone git@github.com:OpenCz/Gcc.git && cd Gcc
cp .env.example .env.prodRemplir .env.prod (voir section Variables d'environnement).
Générer les secrets :
openssl rand -hex 32 # → JWT_SECRET
openssl rand -hex 32 # → ADMIN_SECRETdocker compose -f docker-compose.prod.yml --env-file .env.prod up -d --buildCaddy obtient automatiquement un certificat TLS pour $DOMAIN. Les migrations Prisma s'appliquent au démarrage du backend.
git pull
docker compose -f docker-compose.prod.yml --env-file .env.prod up -d --buildCopier .env.example → .env.prod et compléter :
# Domaine (sans https://)
DOMAIN=mondomaine.com
ACME_EMAIL=contact@mondomaine.com
# PostgreSQL
POSTGRES_USER=postgres
POSTGRES_PASSWORD=<mot de passe fort>
POSTGRES_DB=gcc_db
# Backend
DATABASE_URL=postgresql://postgres:<mot de passe fort>@db:5432/gcc_db
JWT_SECRET=<openssl rand -hex 32>
ADMIN_SECRET=<openssl rand -hex 32>
FRONTEND_URL=https://mondomaine.com
MICROSOFT_REDIRECT_URI=https://mondomaine.com/auth/callback
API_URL=https://mondomaine.com
# Microsoft OAuth (Azure AD)
MICROSOFT_CLIENT_ID=
MICROSOFT_CLIENT_SECRET=
MICROSOFT_TENANT_ID=
ADMIN_SECRETest le mot de passe de la zone admin (/admin).
.
├── backend/
│ ├── prisma/
│ │ ├── schema.prisma
│ │ └── migrations/
│ ├── src/
│ │ ├── index.ts # Point d'entrée Elysia
│ │ ├── routes/ # admin, manta, prospect, auth
│ │ ├── services/ # logique métier
│ │ ├── models/ # accès Prisma
│ │ └── middlewares/
│ └── Dockerfile
├── frontend/
│ ├── src/
│ │ ├── pages/ # AdminPage, MantaPage, ResourcesPage…
│ │ └── components/
│ ├── build.ts # Build Bun avec injection API_URL
│ ├── nginx.conf
│ └── Dockerfile
├── caddy/
│ └── Caddyfile # Routing path-based, HTTPS auto
├── docker-compose.dev.yml
├── docker-compose.prod.yml
└── .env.example
En production le terminal n'est pas interactif, utiliser migrate deploy :
# Créer une migration (en dev)
cd backend && bunx prisma migrate dev --name nom_de_la_migration
# Appliquer en prod (automatique au démarrage, ou manuellement)
docker compose -f docker-compose.prod.yml exec backend bunx prisma migrate deployPour Prisma Studio depuis le serveur (via tunnel SSH) :
# Sur le serveur
docker run --rm -it \
--network gcc-back-prod \
-p 5555:5555 \
-e DATABASE_URL=postgresql://... \
gcc-backend bunx prisma studio --port 5555 --browser none
# Sur votre machine
ssh -L 5555:localhost:5555 user@vps
# Ouvrir http://localhost:5555GitHub Actions (.github/workflows/ci.yml) vérifie à chaque push sur main et dev :
- Type-check TypeScript (backend + frontend)
- Validation du schéma Prisma