Une application SaaS éducative nécessite une séparation stricte des données entre établissements scolaires. L'architecture multi-tenant par sous-domaine (ecole-alpha.classeo.local) permet cette isolation tout en utilisant une base de code unique. Le choix d'une résolution basée sur les sous-domaines plutôt que sur des headers ou tokens facilite le routage au niveau infrastructure (reverse proxy) et offre une UX plus naturelle où chaque école accède à "son" URL dédiée.
161 lines
4.4 KiB
Markdown
161 lines
4.4 KiB
Markdown
# Classeo
|
|
|
|
Application de gestion scolaire moderne - Backend Symfony 8 + Frontend SvelteKit 2.
|
|
|
|
## Quick Start
|
|
|
|
### Prerequis
|
|
|
|
- Docker Desktop 24+ avec Docker Compose 2.20+
|
|
- Git
|
|
|
|
### Configuration /etc/hosts (multi-tenant)
|
|
|
|
Classeo utilise une architecture multi-tenant basée sur les sous-domaines. Ajoutez cette ligne à `/etc/hosts` :
|
|
|
|
```bash
|
|
sudo sh -c 'echo "127.0.0.1 classeo.local ecole-alpha.classeo.local ecole-beta.classeo.local" >> /etc/hosts'
|
|
```
|
|
|
|
### Lancement
|
|
|
|
```bash
|
|
# Cloner le repo
|
|
git clone https://github.com/ClasseoEdu/classeo.git
|
|
cd classeo
|
|
|
|
# Lancer tous les services
|
|
docker compose up -d
|
|
|
|
# Verifier le statut
|
|
docker compose ps
|
|
|
|
# Verifier que les tenants répondent
|
|
make check-tenants
|
|
```
|
|
|
|
### URLs
|
|
|
|
#### Multi-tenant (recommandé)
|
|
|
|
| Service | URL | Description |
|
|
|---------|-----|-------------|
|
|
| Frontend Alpha | http://ecole-alpha.classeo.local:5174 | Tenant ecole-alpha |
|
|
| Frontend Beta | http://ecole-beta.classeo.local:5174 | Tenant ecole-beta |
|
|
| API Alpha | http://ecole-alpha.classeo.local:18000/api | API tenant ecole-alpha |
|
|
| API Beta | http://ecole-beta.classeo.local:18000/api | API tenant ecole-beta |
|
|
| API Docs | http://ecole-alpha.classeo.local:18000/api/docs | Documentation OpenAPI |
|
|
|
|
#### Services partagés
|
|
|
|
| Service | URL | Description |
|
|
|---------|-----|-------------|
|
|
| RabbitMQ | http://localhost:15672 | Admin (guest/guest) |
|
|
| Meilisearch | http://localhost:7700 | Dashboard recherche |
|
|
| Mailpit | http://localhost:8025 | Emails de test |
|
|
| Mercure | http://localhost:3000/.well-known/mercure | SSE Hub |
|
|
|
|
## Stack Technique
|
|
|
|
### Backend
|
|
|
|
- **PHP 8.5** avec property hooks et asymmetric visibility
|
|
- **Symfony 8.0** - Framework DDD-friendly
|
|
- **API Platform 4.x** - API REST auto-generee
|
|
- **Doctrine ORM 3.x** - Persistence avec mappings separes
|
|
- **PHPStan level 9** - Analyse statique stricte
|
|
|
|
### Frontend
|
|
|
|
- **SvelteKit 2.x** - SSR, routing, PWA
|
|
- **Svelte 5** - Runes (`$state`, `$derived`, `$effect`)
|
|
- **TypeScript strict** - Typage fort
|
|
- **TanStack Query 5** - Server state management
|
|
- **Tailwind CSS 3** - Utility-first CSS
|
|
|
|
### Infrastructure
|
|
|
|
- **PostgreSQL 18.1** - Base de donnees
|
|
- **Redis 7.4** - Cache + Sessions
|
|
- **RabbitMQ 4.2** - Message queue
|
|
- **Mercure** - Real-time SSE
|
|
- **Meilisearch 1.12** - Full-text search
|
|
- **Mailpit** - Email testing
|
|
|
|
## Architecture
|
|
|
|
### Bounded Contexts
|
|
|
|
```
|
|
backend/src/
|
|
├── Administration/ # Gestion etablissement, utilisateurs
|
|
├── Scolarite/ # Notes, classes, emploi du temps
|
|
├── VieScolaire/ # Absences, retards, sanctions
|
|
├── Communication/ # Messages, notifications
|
|
└── Shared/ # Kernel partage (EntityId, DomainEvent, etc.)
|
|
```
|
|
|
|
### Structure DDD
|
|
|
|
Chaque Bounded Context suit la meme structure :
|
|
|
|
```
|
|
{BC}/
|
|
├── Domain/ # Pure PHP - ZERO dependance framework
|
|
│ ├── Model/ # Aggregates, Entities, Value Objects
|
|
│ ├── Event/ # Domain Events
|
|
│ ├── Repository/ # Interfaces repository
|
|
│ └── Service/ # Domain Services
|
|
├── Application/ # Use cases
|
|
│ ├── Command/ # Write operations
|
|
│ ├── Query/ # Read operations
|
|
│ └── EventHandler/ # Domain event handlers
|
|
└── Infrastructure/ # Implementations framework
|
|
├── Persistence/ # Doctrine repositories
|
|
├── Api/ # API Platform resources
|
|
└── Messaging/ # RabbitMQ handlers
|
|
```
|
|
|
|
## Developpement
|
|
|
|
### Commandes utiles
|
|
|
|
```bash
|
|
# Backend
|
|
docker compose exec php composer phpstan # Analyse statique
|
|
docker compose exec php composer test # Tests PHPUnit
|
|
docker compose exec php composer cs-fix # Correction code style
|
|
|
|
# Frontend
|
|
docker compose exec frontend pnpm run lint # ESLint
|
|
docker compose exec frontend pnpm run check # TypeScript check
|
|
docker compose exec frontend pnpm run test # Vitest
|
|
docker compose exec frontend pnpm run test:e2e # Playwright
|
|
```
|
|
|
|
### Makefile (raccourcis)
|
|
|
|
```bash
|
|
make up # docker compose up -d
|
|
make down # docker compose down
|
|
make logs # docker compose logs -f
|
|
make test # Run all tests
|
|
make lint # Run all linters
|
|
```
|
|
|
|
## Tests
|
|
|
|
- **PHPUnit** - Tests unitaires et integration backend
|
|
- **Vitest** - Tests unitaires frontend
|
|
- **Playwright** - Tests E2E
|
|
|
|
## Documentation
|
|
|
|
- [Architecture Decision Records](./docs/adr/)
|
|
- [Contributing Guide](./CONTRIBUTING.md)
|
|
- [API Documentation](http://localhost:8000/api/docs)
|
|
|
|
## Licence
|
|
|
|
Proprietary - ClasseoEdu
|