# august7337/sae_leboncoin_cs architecture

> Architecture diagram of the GitHub repository august7337/sae_leboncoin_cs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/august7337/sae_leboncoin_cs
- Repository: https://github.com/august7337/sae_leboncoin_cs

## Overview

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: [`LeboncoinAPI/LeboncoinAPI/Controllers`](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Controllers) (Controllers), [`LeboncoinClient/tests/unit`](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/tests/unit) (UI tests), [`LeboncoinClient/src/views`](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/src/views) (Feature views), [`LeboncoinClient/src/services`](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/src/services) (API services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Vue SPA"]
  node_client_entry["SPA entry<br/>Vue/Vite shell<br/>[main.js]"]
  node_client_router["Router<br/>[index.js]"]
  node_client_views["Feature views<br/>Vue pages"]
  node_client_components["Shared UI<br/>Vue components"]
  node_client_services["API services<br/>Axios clients"]
  node_client_auth["Auth state<br/>session/cookie<br/>[auth.js]"]
end

subgraph group_backend["ASP.NET API"]
  node_api_entry["API host<br/>ASP.NET Core<br/>[Program.cs]"]
  node_api_controllers["Controllers<br/>REST endpoints"]
  node_api_managers["Managers<br/>domain services"]
  node_api_authz["AuthZ rules<br/>RBAC/permissions"]
  node_incident_workflow["Incident flow<br/>workflow service"]
  node_api_dtos["DTOs<br/>transport models"]
  node_ef_models["EF models<br/>entity models"]
  node_repositories["Repositories<br/>persistence contracts"]
  node_db_context["DB context<br/>EF Core context"]
  node_postgresql[("PostgreSQL<br/>primary datastore<br/>[schema.sql]")]
  node_schema_sql["Schema SQL<br/>bootstrap SQL<br/>[schema.sql]"]
  node_migrations["Migrations<br/>schema history"]
  node_incident_uploads["Incident files<br/>local file store"]
end

subgraph group_ops["Delivery"]
  node_ci_cd["CI/CD<br/>GitHub Actions<br/>[pipeline.yml]"]
  node_docker_stack["Docker stack<br/>containers<br/>[docker-compose.yml]"]
end

subgraph group_tests["Tests"]
  node_api_tests["API tests<br/>xUnit tests"]
  node_ui_tests["UI tests<br/>Vitest suite"]
end

node_client_entry -->|"bootstraps"| node_client_router
node_client_router -->|"navigates"| node_client_views
node_client_views -->|"reuses"| node_client_components
node_client_views -->|"fetches data"| node_client_services
node_client_services -->|"uses session"| node_client_auth
node_client_services -->|"HTTP"| node_api_controllers
node_api_entry -->|"hosts"| node_api_controllers
node_api_controllers -->|"delegates"| node_api_managers
node_api_managers -->|"reads/writes"| node_repositories
node_repositories -->|"implemented by"| node_db_context
node_db_context -->|"maps"| node_ef_models
node_ef_models -->|"persists"| node_postgresql
node_schema_sql -->|"boots"| node_postgresql
node_migrations -->|"evolves"| node_postgresql
node_api_dtos -->|"contracts"| node_api_controllers
node_api_managers -->|"coordinates"| node_incident_workflow
node_api_authz -->|"guards"| node_api_controllers
node_api_authz -->|"authorizes"| node_incident_workflow
node_incident_uploads -->|"file handling"| node_api_controllers
node_api_tests -->|"verifies"| node_api_controllers
node_api_tests -->|"verifies"| node_api_managers
node_ui_tests -->|"verifies"| node_client_views
node_ui_tests -->|"verifies"| node_client_services
node_ui_tests -->|"verifies"| node_client_auth
node_ci_cd -->|"runs"| node_api_tests
node_ci_cd -->|"runs"| node_ui_tests
node_docker_stack -->|"deploys"| node_api_entry
node_docker_stack -->|"deploys"| node_client_entry

click node_client_entry "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinClient/src/main.js"
click node_client_router "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinClient/src/router/index.js"
click node_client_views "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/src/views"
click node_client_components "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/src/components"
click node_client_services "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/src/services"
click node_client_auth "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinClient/src/auth.js"
click node_api_entry "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Program.cs"
click node_api_controllers "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Controllers"
click node_api_managers "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Models/DataManager"
click node_api_authz "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Services/AuthorizationConstants.cs"
click node_incident_workflow "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Services/IncidentWorkflowService.cs"
click node_api_dtos "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Models/DTOs"
click node_ef_models "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Models/EntityFramework"
click node_repositories "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Models/Repository"
click node_db_context "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Models/EntityFramework/LeboncoinDBContext.cs"
click node_postgresql "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Database/schema.sql"
click node_schema_sql "https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Database/schema.sql"
click node_migrations "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Migrations"
click node_incident_uploads "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/wwwroot/uploads/incidents"
click node_api_tests "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPITests"
click node_ui_tests "https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/tests/unit"
click node_ci_cd "https://github.com/august7337/sae_leboncoin_cs/blob/main/.github/workflows/pipeline.yml"
click node_docker_stack "https://github.com/august7337/sae_leboncoin_cs/blob/main/docker/docker-compose.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_entry,node_client_router,node_client_views,node_client_components,node_client_services,node_client_auth toneBlue
class node_api_entry,node_api_controllers,node_api_managers,node_api_authz,node_incident_workflow,node_api_dtos,node_ef_models,node_repositories,node_db_context,node_postgresql,node_schema_sql,node_migrations,node_incident_uploads toneAmber
class node_ci_cd,node_docker_stack toneMint
class node_api_tests,node_ui_tests toneRose
```

## Components

### Vue SPA

Client-side application and UI feature areas.

- [SPA entry](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinClient/src/main.js): Vue/Vite shell · Main client bootstrap and app composition. · `LeboncoinClient/src/main.js`
- [Router](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinClient/src/router/index.js): Vue Router · Route definitions and navigation boundaries. · `LeboncoinClient/src/router/index.js`
- [Feature views](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/src/views): Vue pages · Route-focused screens for auth, marketplace, account, incidents, messages, and services. · `LeboncoinClient/src/views`
- [Shared UI](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/src/components): Vue components · Reusable widgets such as filters, file upload, carousels, banners, and dashboards. · `LeboncoinClient/src/components`
- [API services](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/src/services): Axios clients · Service modules that call backend endpoints for domain features. · `LeboncoinClient/src/services`
- [Auth state](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinClient/src/auth.js): session/cookie · 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](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Program.cs): ASP.NET Core · Application startup, hosting, and dependency wiring. · `LeboncoinAPI/LeboncoinAPI/Program.cs`
- [Controllers](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Controllers): REST endpoints · HTTP boundary for listings, reservations, messages, incidents, users, and reference data. · `LeboncoinAPI/LeboncoinAPI/Controllers`
- [Managers](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Models/DataManager): domain services · Business rules and orchestration for marketplace, messaging, reservations, users, and incidents. · `LeboncoinAPI/LeboncoinAPI/Models/DataManager`
- [AuthZ rules](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Services/AuthorizationConstants.cs): RBAC/permissions · Central role and permission constants plus incident workflow authorization. · `LeboncoinAPI/LeboncoinAPI/Services/AuthorizationConstants.cs`
- [Incident flow](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Services/IncidentWorkflowService.cs): workflow service · State progression and role-based transitions for incident handling. · `LeboncoinAPI/LeboncoinAPI/Services/IncidentWorkflowService.cs`
- [DTOs](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Models/DTOs): transport models · Request and response contracts between client and API. · `LeboncoinAPI/LeboncoinAPI/Models/DTOs`
- [EF models](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Models/EntityFramework): entity models · Entity Framework Core mappings for listings, users, bookings, incidents, messages, and reference data. · `LeboncoinAPI/LeboncoinAPI/Models/EntityFramework`
- [Repositories](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Models/Repository): persistence contracts · Repository interfaces defining data access boundaries. · `LeboncoinAPI/LeboncoinAPI/Models/Repository`
- [DB context](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Models/EntityFramework/LeboncoinDBContext.cs): EF Core context · Unit of work and entity set configuration. · `LeboncoinAPI/LeboncoinAPI/Models/EntityFramework/LeboncoinDBContext.cs`
- [PostgreSQL](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Database/schema.sql): primary datastore · System of record for marketplace data and workflows. · `LeboncoinAPI/LeboncoinAPI/Database/schema.sql`
- [Schema SQL](https://github.com/august7337/sae_leboncoin_cs/blob/main/LeboncoinAPI/LeboncoinAPI/Database/schema.sql): bootstrap SQL · Explicit database bootstrap schema and seed/reset scripts. · `LeboncoinAPI/LeboncoinAPI/Database/schema.sql`
- [Migrations](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/Migrations): schema history · Incremental EF migration history for evolving the database. · `LeboncoinAPI/LeboncoinAPI/Migrations`
- [Incident files](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPI/wwwroot/uploads/incidents): local file store · API-hosted upload storage for incident evidence under wwwroot. · `LeboncoinAPI/LeboncoinAPI/wwwroot/uploads/incidents`

### Delivery

Containerization, CI, and deployment assets.

- [CI/CD](https://github.com/august7337/sae_leboncoin_cs/blob/main/.github/workflows/pipeline.yml): GitHub Actions · Pipeline and deployment automation for build, test, and publish steps. · `.github/workflows/pipeline.yml`
- [Docker stack](https://github.com/august7337/sae_leboncoin_cs/blob/main/docker/docker-compose.yml): containers · Compose, image, and deployment assets for separate API and SPA runtimes. · `docker/docker-compose.yml`

### Tests

Focused API and UI test suites.

- [API tests](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinAPI/LeboncoinAPITests): xUnit tests · Focused controller and manager validation for backend behavior. · `LeboncoinAPI/LeboncoinAPITests`
- [UI tests](https://github.com/august7337/sae_leboncoin_cs/tree/main/LeboncoinClient/tests/unit): Vitest suite · View, component, service, auth, and cookie tests for the SPA. · `LeboncoinClient/tests/unit`

## Connections

- 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.
