How baptwild/projet-annuel-2026 works
1. System shape
- This repo is a two-app monolith: a Symfony 8 backend and a Next.js 16 frontend, connected through HTTP and run together with Docker Compose.
- A MySQL 8 database is the shared persistence layer.
- The frontend is the user-facing app; the backend is the source of truth for authentication, business rules, and data access.
2. Backend boundary
- The Symfony backend exposes a mix of custom controllers and API Platform resources.
- Main backend entrypoints are:
- /auth/login for JWT login
- /api/* for resource APIs
- custom app routes such as /register, /me, and occupancy-related endpoints
- Security is handled server-side with JWT authentication and Symfony security config.
3. Core domain model
- The main entities are User, Dog, Daycare, and Booking.
- BookingStatus captures the lifecycle of a booking: pending, confirmed, cancelled, completed.
- The business domain is centered on daycare reservation management: users own dogs, dogs book daycare time, and daycares control capacity and pricing.
4. Business logic placement
- The backend keeps non-trivial rules in dedicated layers:
- State/BookingProcessor.php and State/DogProcessor.php handle write-side processing, likely through API Platform state hooks.
- Controller/OccupancyController.php computes or returns day occupancy information.
- Entity methods plus unit tests suggest booking state helpers live partly on the model itself.
- This separation implies the backend is not just CRUD; it enforces booking rules, duplicate-day prevention, and status transitions.
5. Multi-tenant architecture
- The repository is explicitly multi-tenant: each daycare is a tenant, and data must not leak between them.
- Doctrine/TenantExtension.php is the key architectural clue: it likely filters queries by current daycare context.
- Tests confirm this boundary: an admin or user in one daycare must not see bookings, dogs, or users from another daycare.
6. Authentication and user flows
- Login uses JWT; demo instructions show token acquisition via /auth/login.
- RegisterController.php handles account creation, and MeController.php exposes the authenticated user’s profile area.
- The frontend sends auth headers via src/utils/authHeaders.ts, so authenticated API calls are a first-class flow.
7. Booking and occupancy flow
- Booking creation is a multi-step domain flow:
- user selects a dog
- picks a day and time slots
- frontend asks the backend for availability/occupancy
- backend validates capacity and duplicate-dog-per-day constraints
- booking is persisted with a status, then later processed by admin actions
- Occupancy is surfaced to the user even when the daycare is full, which implies the backend returns both capacity state and current bookings for a date.
8. Admin workflow
- The /admin section in the frontend is a separate operational surface for daycare staff.
- It manages:
- bookings by week and status
- confirm/cancel/complete transitions
- pricing and schedule settings
- monthly revenue reporting
- This area depends on backend reads that are tenant-scoped and likely role-restricted.
9. Frontend architecture
- The frontend is a Next.js App Router application, organized by route segment under src/app/[slug].
- The [slug] segment strongly suggests tenant-specific routing in the UI, matching the backend’s multi-tenant model.
- UI composition follows a design-system style breakdown: atoms, molecules, organisms, and page-level components.
10. Frontend data layer
- Data access is centralized in custom hooks such as useAuth, useLogin, useRegister, useMe, useBooking, useDaycare, useAdminBookings, and useAdminUsers.
- These hooks are the bridge between React pages and the Symfony API.
- Shared helper modules handle domain calculations on the client side, such as date windows, time slots, billing, and availability formatting.
11. Presentation and styling
- The frontend uses Sass heavily, with a structured component stylesheet tree mirroring the React component hierarchy.
- Static assets live in public/, while layout concerns are split across reusable header/footer/wrapper components.
- This indicates a strongly componentized UI, not a server-rendered template app.
12. Backend presentation layer
- Symfony still contains Twig templates and some Asset Mapper/Stimulus assets, but these look secondary.
- The main backend responsibility is API and business logic, not HTML rendering.
- The presence of assets/controllers and ux_turbo suggests some progressive-enhancement tooling, but it is not the primary app shell.
13. Data initialization and testability
- DataFixtures/AppFixtures.php seeds demo tenants, users, dogs, and bookings.
- Doctrine migrations define the schema, and tests use a separate app_test database.
- Functional tests cover auth, booking rules, occupancy, and tenant isolation, which is important because those are the system’s key boundaries.
14. Deployment/runtime boundary
- The repo is designed to run as three containers: backend, frontend, and MySQL.
- The Docker setup and Makefile automate bootstrapping, migrations, JWT key generation, and fixture loading.
- In diagram terms, the only persistent state is in MySQL; both app containers are stateless and rebuilt from code.
15. Most important diagram edges
- Browser → Next.js frontend
- Next.js frontend → Symfony backend API over HTTP with JWT
- Symfony backend → MySQL via Doctrine
- Symfony backend → internal tenant filter / security boundary before any DB access
- Backend fixtures/migrations → database initialization path
- Tests → backend API and tenant boundary verification
Main entry points: app Next.js app · Entity Domain models · index.php Symfony app · docker-compose.yml Docker Compose
Components 16
Runtime
Containers and shared infrastructure
- Browser · User-facing entry point
- Docker Compose · Runs backend, frontend, and MySQL together
docker-compose.yml - MySQL · Shared persistent datastore
Symfony backend
API, auth, domain rules, and persistence access
- Symfony app · Backend entrypoint and framework runtime
backend/public/index.php - API routes · Login, register, profile, occupancy, and API Platform routes
backend/src/Controller - Security · JWT login and Symfony access control
backend/config/packages/security.yaml - Domain models · User, Dog, Daycare, Booking, and booking status
backend/src/Entity - Write processors · API Platform state processors for booking and dog writes
backend/src/State - Tenant filter · Scopes queries to the current daycare tenant
backend/src/Doctrine/TenantExtension.php - Fixtures & migrations · Seeds demo data and defines schema evolution
backend/src/DataFixtures/AppFixtures.php
Next.js frontend
Tenant-aware UI and client data access
- Next.js app · App Router frontend served by React and SSR/CSR
frontend/src/app - UI system · Atoms, molecules, organisms, and page sections
frontend/src/components - Data hooks · Centralized React hooks for auth, booking, daycare, and admin data
frontend/src/hooks - Client utils · Date, slot, billing, and auth helpers
frontend/src/utils
Verification
Functional and unit coverage around core boundaries
- Functional tests · Auth, booking, occupancy, and tenant isolation coverage
backend/tests/Functional - Unit tests · Entity-level booking behavior checks
backend/tests/Unit/Entity
Connections 19
- Browser → Next.js app: uses · Users interact with the tenant-aware frontend
- Next.js app → Data hooks: loads data · Pages delegate API access to custom hooks
- Data hooks → Client utils: formats · Hooks rely on shared client-side domain helpers
- Next.js app → UI system: renders · Route pages compose reusable UI components
- Next.js app → Symfony app: HTTP + JWT · Frontend calls the Symfony API over authenticated requests
- Docker Compose → Next.js app: runs · Compose starts the frontend container
- Docker Compose → Symfony app: runs · Compose starts the backend container
- Docker Compose → MySQL: runs · Compose provides the shared database container
- Symfony app → Security: guards · Requests pass through server-side authentication and authorization
- Security → API routes: permits · Authenticated access unlocks controllers and API resources
- API routes → Domain models: reads/writes · Controllers expose and mutate core daycare data
- Write processors → Domain models: mutates · State processors enforce booking and dog write rules
- Tenant filter → Domain models: scopes · Doctrine filters keep reads tenant-isolated
- Domain models → MySQL: persists via Doctrine · Entities are stored in the shared MySQL database
- Fixtures & migrations → MySQL: initializes · Migrations and fixtures prepare the database state
- Functional tests → API routes: verifies · Functional tests exercise auth, booking, and occupancy endpoints
- Functional tests → Tenant filter: verifies · Functional tests assert daycare isolation boundaries
- Unit tests → Domain models: verifies · Unit tests cover booking entity behavior
- Symfony app → Fixtures & migrations: bootstraps · Runtime and setup scripts load schema and demo data