How august7337/sae_leboncoin_cs works
1. Repo shape
- This is a two-app full-stack repository: a .NET 8 ASP.NET Core API in LeboncoinAPI/ and a Vue 3 SPA in LeboncoinClient/.
- The main runtime boundary is HTTP: the Vue app calls the API, and the API owns persistence, business rules, authentication/authorization, and file handling.
2. Backend as the system of record
- The backend is the authoritative layer for marketplace data: listings, users, bookings, messages, incidents, roles/permissions, and supporting reference data.
- It exposes REST endpoints through controllers such as AnnoncesController, ReservationsController, MessagesController, IncidentsController, and UtilisateursController.
3. Backend layering
- The API is structured in a classic layered shape:
- Controllers handle request/response concerns.
- DataManager classes contain domain/data access logic (AnnonceManager, ReservationManager, IncidentManager, etc.).
- Repository interfaces define persistence contracts.
- Entity Framework entities in Models/EntityFramework map the domain to the database.
- DTOs sit between API and client to keep transport models separate from EF entities.
4. Persistence and schema management
- The data store is PostgreSQL, accessed through Entity Framework Core.
- The repo includes both Database/schema.sql and EF migrations, showing two schema-management paths: explicit SQL bootstrap plus incremental migration history.
- Seed/reset support is present via inserts.sql, drop-table.sql, and migrate_and_seed.ps1.
5. Main domain boundaries
- The domain is centered on a rental marketplace:
- Listings: Annonce, Photo, Categorie, TypeHebergement, Commodite, Recherche
- Users: Utilisateur, Particulier, Professionnel, Role, Permission
- Bookings and transactions: Reservation, Transaction, availability-related entities
- Support and moderation: Incident, IncidentHistorique, StatutIncident, Message, DemandeSuppressionCompte
- These are not isolated features; they interact heavily through user roles, reservations, and incident workflows.
6. Authorization and workflow complexity
- The backend has a notable RBAC/permission model, with migrations dedicated to incident workflow authorization, client role assignment, and permissions such as GDPR and “my incidents”.
- Services/IncidentWorkflowService.cs suggests the incident feature has explicit state progression and role-based transitions, not just CRUD.
- AuthorizationConstants.cs indicates centralized permission/role names used across controllers and services.
7. Incident subsystem
- Incidents are a distinct subsystem with their own controller, manager, DTOs, entities, workflow service, and persisted history.
- The presence of wwwroot/uploads/incidents/ shows incidents can carry uploaded files or evidence, stored locally by the API rather than in an external object store.
- This subsystem likely has the strongest coupling to permissions, history tracking, and service dashboards.
8. Frontend architecture
- The client is a Vue 3 + Vite SPA with Vue Router and Tailwind-based styling.
- App entry points are src/main.js and src/App.vue; navigation is organized by route-focused views under src/views/.
- The frontend is split into feature areas: auth, annonces, reservations, messages, incidents, profile/account, services dashboards, and legal pages.
9. Frontend data flow
- The SPA talks to the API through service modules in src/services/ and Axios setup in src/api/.
- auth.js and cookieManager.js suggest client-side session/token and consent handling are centralized, while views remain mostly presentation-focused.
- Components are reused across views for filters, date picking, uploads, carousels, notifications, and cookie consent.
10. User-facing feature surfaces
- The client includes distinct screens for:
- authentication and onboarding (LoginView, RegisterView, password reset, email verification)
- marketplace browsing and creation (HomeView, AnnonceView, CreateAnnonceView, EditAnnonceView)
- personal account management (MyAnnoncesView, MyReservationsView, SavedSearchesView, GdprDataView)
- messaging and incident handling (ConversationView, CreateIncidentView, TimelineView, MyIncidentsView)
- service/operator dashboards (LocationDashboardView, ContentieuxDashboardView, ComptabiliteDashboardView)
- This indicates the UI is organized around both consumer and operational workflows, not only public browsing.
11. Testing strategy
- The backend has focused tests for controllers and data managers in LeboncoinAPITests, reflecting a service/API validation approach.
- The frontend has a broad Vitest suite for views, components, services, auth utilities, and cookie logic, showing the UI is heavily unit-tested at the page/component boundary.
12. Delivery and deployment boundary
- Docker assets (docker/Dockerfile.api, docker-compose.yml, deploy scripts) show the app is designed to be run as separate containers/services.
- GitHub Actions pipeline support exists, so CI is part of the repo’s operational architecture.
- In development, the API runs on local Kestrel endpoints and the SPA runs separately on Vite, with the frontend configured through VITE_API_BASE_URL.
13. What to draw in an architecture diagram
- A good diagram should show:
- a Vue SPA client
- an ASP.NET Core REST API
- PostgreSQL as the primary datastore
- local file storage for incident uploads under the API
- backend internal layers: controllers → managers/services → EF Core → database
- frontend internal layers: router/views/components → API services → Axios
- cross-cutting authorization/permissions spanning user, reservations, and incident flows
Main entry points: Controllers Controllers · unit UI tests · views Feature views · services API services
Components 23
Vue SPA
Client-side application and UI feature areas.
- SPA entry · Main client bootstrap and app composition.
LeboncoinClient/src/main.js - Router · Route definitions and navigation boundaries.
LeboncoinClient/src/router/index.js - Feature views · Route-focused screens for auth, marketplace, account, incidents, messages, and services.
LeboncoinClient/src/views - Shared UI · Reusable widgets such as filters, file upload, carousels, banners, and dashboards.
LeboncoinClient/src/components - API services · Service modules that call backend endpoints for domain features.
LeboncoinClient/src/services - Auth state · Client-side auth, consent, and session handling helpers.
LeboncoinClient/src/auth.js
ASP.NET API
Server-side REST API, domain logic, and persistence.
- API host · Application startup, hosting, and dependency wiring.
LeboncoinAPI/LeboncoinAPI/Program.cs - Controllers · HTTP boundary for listings, reservations, messages, incidents, users, and reference data.
LeboncoinAPI/LeboncoinAPI/Controllers - Managers · Business rules and orchestration for marketplace, messaging, reservations, users, and incidents.
LeboncoinAPI/LeboncoinAPI/Models/DataManager - AuthZ rules · Central role and permission constants plus incident workflow authorization.
LeboncoinAPI/LeboncoinAPI/Services/AuthorizationConstants.cs - Incident flow · State progression and role-based transitions for incident handling.
LeboncoinAPI/LeboncoinAPI/Services/IncidentWorkflowService.cs - DTOs · Request and response contracts between client and API.
LeboncoinAPI/LeboncoinAPI/Models/DTOs - EF models · Entity Framework Core mappings for listings, users, bookings, incidents, messages, and reference data.
LeboncoinAPI/LeboncoinAPI/Models/EntityFramework - Repositories · Repository interfaces defining data access boundaries.
LeboncoinAPI/LeboncoinAPI/Models/Repository - DB context · Unit of work and entity set configuration.
LeboncoinAPI/LeboncoinAPI/Models/EntityFramework/LeboncoinDBContext.cs - PostgreSQL · System of record for marketplace data and workflows.
LeboncoinAPI/LeboncoinAPI/Database/schema.sql - Schema SQL · Explicit database bootstrap schema and seed/reset scripts.
LeboncoinAPI/LeboncoinAPI/Database/schema.sql - Migrations · Incremental EF migration history for evolving the database.
LeboncoinAPI/LeboncoinAPI/Migrations - Incident files · API-hosted upload storage for incident evidence under wwwroot.
LeboncoinAPI/LeboncoinAPI/wwwroot/uploads/incidents
Delivery
Containerization, CI, and deployment assets.
- CI/CD · Pipeline and deployment automation for build, test, and publish steps.
.github/workflows/pipeline.yml - Docker stack · Compose, image, and deployment assets for separate API and SPA runtimes.
docker/docker-compose.yml
Connections 28
- SPA entry → Router: bootstraps · SPA entry mounts routed application.
- Router → Feature views: navigates · Routes resolve to feature views.
- Feature views → Shared UI: reuses · Pages share common UI building blocks.
- Feature views → API services: fetches data · Views call domain services for API-backed state.
- API services → Auth state: uses session · Service calls are shaped by auth/session handling.
- API services → Controllers: HTTP · Axios service modules call the REST API.
- API host → Controllers: hosts · Application startup wires controllers into the HTTP pipeline.
- Controllers → Managers: delegates · Controllers defer business logic to managers.
- Managers → Repositories: reads/writes · Managers depend on repository contracts for persistence.
- Repositories → DB context: implemented by · Repository contracts are backed by EF Core context access.
- DB context → EF models: maps · Context tracks entity models and relationships.
- EF models → PostgreSQL: persists · EF Core stores marketplace data in PostgreSQL.
- Schema SQL → PostgreSQL: boots · Explicit SQL defines the baseline database schema.
- Migrations → PostgreSQL: evolves · Migrations incrementally change the schema.
- DTOs → Controllers: contracts · DTOs define controller request and response payloads.
- Managers → Incident flow: coordinates · Incident manager logic is guided by workflow transitions.
- AuthZ rules → Controllers: guards · Permission names and roles are enforced at the API boundary.
- AuthZ rules → Incident flow: authorizes · Incident transitions depend on role/permission rules.
- Incident files → Controllers: file handling · Incident endpoints serve and store uploaded evidence locally.
- API tests → Controllers: verifies · Backend tests cover controller behavior.
- API tests → Managers: verifies · Backend tests cover manager logic.
- UI tests → Feature views: verifies · Vitest exercises route views and page behavior.
- UI tests → API services: verifies · Tests cover service modules and client data flow.
- UI tests → Auth state: verifies · Tests cover auth and cookie/session helpers.
- CI/CD → API tests: runs · Pipeline builds and validates backend tests.
- CI/CD → UI tests: runs · Pipeline builds and validates frontend tests.
- Docker stack → API host: deploys · Container stack runs the API as a separate service.
- Docker stack → SPA entry: deploys · Container stack runs the SPA separately from the API.