# mohammedbenlaiter/projectalter architecture

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

- Interactive diagram: https://gitdiagram.com/mohammedbenlaiter/projectalter
- Repository: https://github.com/mohammedbenlaiter/projectalter

## Overview

1. **Overall shape**
   - This is a single ASP.NET Core **.NET 8** application that combines a **REST API** with a small **MVC/Razor UI**.  
   - The repository is organized as a **modular monolith**: controllers, DTOs, EF-style models, authentication helpers, and a SignalR hub all live in the same process.

2. **Primary business domain**
   - The platform is for **exchanging skills and services**.
   - The domain is centered around users creating and matching:
     - **Skills**
     - **Requests**
     - **Offers**
     - **Exchanges**
     - **Wishlists**
     - **Messages / chat**
     - **Feedback / ratings**
     - **Certifications**
   - This implies the core system flow is: user discovery → skill/request/offer creation → exchange negotiation → messaging → feedback.

3. **HTTP API layer**
   - The `Controllers/` folder is the main entry point for client calls.
   - Controllers are split by domain concern:
     - `UserController`
     - `SkillController`
     - `OfferController`
     - `RequestController`
     - `ExchangeController`
     - `MessageController`
     - `FeedbackController`
     - `CertificationController`
     - `WishlistController`
     - `HomeController`
   - This indicates a **resource-oriented API**, where each controller owns one slice of the business domain.

4. **Data transfer boundary**
   - `Dtos/` contains the request/response contract objects used at the API boundary.
   - DTOs separate external payloads from internal models for things like:
     - authentication (`LoginDto`, `AuthResponse`, `TokenDto`)
     - user creation/profile (`UserDto`, `UserRegisterDto`, `Username.Dto`)
     - skills and search (`SkillDto`, `SkillSearchDto`, `CreateSkillDto`, `SearchDto`)
     - exchanges, offers, requests, feedback, messaging, notifications
   - This suggests the API is designed to avoid exposing persistence models directly and to support different shapes for create/update/search operations.

5. **Persistence and domain model**
   - `Models/` contains the entity types that represent the persistent business objects.
   - The key types are:
     - `User`, `Skill`, `Request`, `Offer`, `Exchange`
     - `Message`, `Feedback`, `Wishlist`
     - `Certification`, `Language`, `Topic`, `Link`, `Email`
     - `RatingStar`
   - `Models/AlterDbContext.cs` is the likely **database context** that ties these entities together.
   - The architecture appears to be **controller → DTO → EF entity → DbContext/database**, with the controllers probably acting as the main orchestration layer.

6. **Authentication and request security**
   - `ConfigureAuthentication.cs` and `Helpers/JwtMiddleware.cs` show that the app uses **JWT-based authentication**.
   - Security is likely handled at the middleware/pipeline level, with controllers relying on authenticated user identity for protected operations.
   - The presence of token-related DTOs and login/register DTOs suggests the API supports:
     - user registration
     - login
     - token issuance/validation
     - authenticated access to exchange-related actions

7. **Real-time communication**
   - `Hubs/ChatHub.cs` indicates a **SignalR-style real-time messaging layer**.
   - This is a separate communication path from the REST API and likely supports live chat between users involved in an exchange.
   - The `Message` model and `MessageController` suggest a split between:
     - persisted message history via the API/database
     - live delivery/updates via the hub

8. **UI and static content**
   - Even though the README describes a REST API, the repo also includes Razor views under `Views/`.
   - `HomeController` plus `Views/Home` and shared layouts indicate a minimal **server-rendered front-end shell** or landing pages.
   - `wwwroot/` contains Bootstrap, jQuery, and validation scripts, so the app also serves static assets for browser-based pages.

9. **Application runtime composition**
   - `Program.cs` is the composition root where the ASP.NET Core pipeline is assembled.
   - Based on the files present, the runtime likely wires together:
     - controllers and MVC views
     - authentication middleware
     - the database context
     - the chat hub endpoint
     - static file serving
   - `Properties/launchSettings.json` and `appsettings*.json` provide environment-specific startup and configuration settings.

10. **Data flow boundaries to capture in a diagram**
   - There are two main client-facing paths:
     1. **Synchronous HTTP/API path**: browser or client → controller → DTO mapping → domain model / DbContext → database
     2. **Real-time path**: client → `ChatHub` → message broadcast / message persistence
   - Authentication cuts across both, with JWT validation guarding protected routes and likely identifying the current user for exchanges, offers, and messages.

11. **What is notably absent**
   - There is no obvious separate service layer, repository layer, or external integration project in the tree.
   - That suggests business logic is probably concentrated in controllers and helper classes rather than being split into multiple backend services.
   - For architecture diagrams, this should be shown as a **single backend application** with distinct internal modules rather than a distributed system.

12. **How to label the system**
   - The most accurate high-level label is: **ASP.NET Core skills/service exchange platform with REST API, JWT auth, EF-backed persistence, and SignalR chat**.

Main entry points: [`Program.cs`](https://github.com/mohammedbenlaiter/projectalter/blob/master/Program.cs) (Program.cs), [`Dtos`](https://github.com/mohammedbenlaiter/projectalter/tree/master/Dtos) (DTO contracts), [`Models/AlterDbContext.cs`](https://github.com/mohammedbenlaiter/projectalter/blob/master/Models/AlterDbContext.cs) (AlterDbContext), [`Controllers/MessageController.cs`](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/MessageController.cs) (Messages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["ASP.NET Core app"]
end

subgraph group_api["HTTP API"]
  node_usercontroller["Users<br/>controller<br/>[UserController.cs]"]
  node_skillcontroller["Skills<br/>controller<br/>[SkillController.cs]"]
  node_requestcontroller["Requests<br/>controller"]
  node_offercontroller["Offers<br/>controller<br/>[OfferController.cs]"]
  node_exchangecontroller["Exchanges<br/>controller"]
  node_messagecontroller["Messages<br/>controller"]
  node_feedbackcontroller["Feedback<br/>controller"]
  node_certcontroller["Certifications<br/>controller"]
  node_wishlistcontroller["Wishlists<br/>controller"]
  node_dtos["DTO contracts"]
end

subgraph group_domain["Domain model"]
  node_dbcontext[("AlterDbContext<br/>db context<br/>[AlterDbContext.cs]")]
  node_entities["Domain entities"]
end

subgraph group_realtime["Real-time chat"]
  node_chathub{{"ChatHub<br/>signalr hub<br/>[ChatHub.cs]"}}
end

subgraph group_ui["UI shell"]
  node_homecontroller["Home<br/>mvc controller<br/>[HomeController.cs]"]
  node_views["Razor views<br/>mvc views"]
  node_staticassets["Static assets<br/>web assets"]
end

subgraph group_infra["Bootstrap & config"]
  node_program["Program.cs<br/>startup<br/>[Program.cs]"]
  node_authconfig["Auth config<br/>authentication setup"]
  node_jwtmiddleware["JWT middleware<br/>security middleware<br/>[JwtMiddleware.cs]"]
end

node_program -->|"configures"| node_authconfig
node_program -->|"adds"| node_jwtmiddleware
node_program -->|"wires"| node_dbcontext
node_program -->|"maps"| node_usercontroller
node_program -->|"maps"| node_skillcontroller
node_program -->|"maps"| node_requestcontroller
node_program -->|"maps"| node_offercontroller
node_program -->|"maps"| node_exchangecontroller
node_program -->|"maps"| node_messagecontroller
node_program -->|"maps"| node_feedbackcontroller
node_program -->|"maps"| node_certcontroller
node_program -->|"maps"| node_wishlistcontroller
node_program -->|"maps"| node_homecontroller
node_program -->|"maps"| node_chathub
node_homecontroller -->|"renders"| node_views
node_homecontroller -->|"uses"| node_staticassets
node_usercontroller -->|"uses"| node_dtos
node_skillcontroller -->|"uses"| node_dtos
node_requestcontroller -->|"uses"| node_dtos
node_offercontroller -->|"uses"| node_dtos
node_exchangecontroller -->|"uses"| node_dtos
node_messagecontroller -->|"uses"| node_dtos
node_feedbackcontroller -->|"uses"| node_dtos
node_certcontroller -->|"uses"| node_dtos
node_wishlistcontroller -->|"uses"| node_dtos
node_dtos -.->|"maps to"| node_entities
node_dbcontext -->|"tracks"| node_entities
node_messagecontroller -->|"persists"| node_dbcontext
node_exchangecontroller -->|"updates"| node_dbcontext
node_chathub -.->|"shares data"| node_messagecontroller
node_chathub -->|"persists"| node_dbcontext
node_usercontroller -->|"authenticates"| node_dbcontext
node_feedbackcontroller -->|"stores"| node_dbcontext

click node_program "https://github.com/mohammedbenlaiter/projectalter/blob/master/Program.cs"
click node_authconfig "https://github.com/mohammedbenlaiter/projectalter/blob/master/ConfigureAuthentication.cs"
click node_jwtmiddleware "https://github.com/mohammedbenlaiter/projectalter/blob/master/Helpers/JwtMiddleware.cs"
click node_usercontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/UserController.cs"
click node_skillcontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/SkillController.cs"
click node_requestcontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/RequestController.cs"
click node_offercontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/OfferController.cs"
click node_exchangecontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/ExchangeController.cs"
click node_messagecontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/MessageController.cs"
click node_feedbackcontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/FeedbackController.cs"
click node_certcontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/CertificationController.cs"
click node_wishlistcontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/WishlistController.cs"
click node_homecontroller "https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/HomeController.cs"
click node_dtos "https://github.com/mohammedbenlaiter/projectalter/tree/master/Dtos"
click node_dbcontext "https://github.com/mohammedbenlaiter/projectalter/blob/master/Models/AlterDbContext.cs"
click node_entities "https://github.com/mohammedbenlaiter/projectalter/tree/master/Models"
click node_chathub "https://github.com/mohammedbenlaiter/projectalter/blob/master/Hubs/ChatHub.cs"
click node_views "https://github.com/mohammedbenlaiter/projectalter/tree/master/Views"
click node_staticassets "https://github.com/mohammedbenlaiter/projectalter/tree/master/wwwroot"

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_usercontroller,node_skillcontroller,node_requestcontroller,node_offercontroller,node_exchangecontroller,node_messagecontroller,node_feedbackcontroller,node_certcontroller,node_wishlistcontroller,node_dtos toneAmber
class node_dbcontext,node_entities toneMint
class node_chathub toneRose
class node_homecontroller,node_views,node_staticassets toneIndigo
class node_program,node_authconfig,node_jwtmiddleware toneTeal
```

## Components

### HTTP API

Resource-oriented controllers and DTO contracts for client interactions.

- [Users](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/UserController.cs): controller · Handles registration, login, and user-facing account operations. · `Controllers/UserController.cs`
- [Skills](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/SkillController.cs): controller · Manages skill creation, search, and skill-related queries. · `Controllers/SkillController.cs`
- [Requests](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/RequestController.cs): controller · Exposes request creation and request lifecycle operations. · `Controllers/RequestController.cs`
- [Offers](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/OfferController.cs): controller · Creates and manages offers in the exchange workflow. · `Controllers/OfferController.cs`
- [Exchanges](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/ExchangeController.cs): controller · Coordinates exchange matching and exchange state changes. · `Controllers/ExchangeController.cs`
- [Messages](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/MessageController.cs): controller · Persists and retrieves message history for conversations. · `Controllers/MessageController.cs`
- [Feedback](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/FeedbackController.cs): controller · Captures ratings and post-exchange feedback. · `Controllers/FeedbackController.cs`
- [Certifications](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/CertificationController.cs): controller · Manages user certifications and related records. · `Controllers/CertificationController.cs`
- [Wishlists](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/WishlistController.cs): controller · Tracks saved skills or items of interest. · `Controllers/WishlistController.cs`
- [DTO contracts](https://github.com/mohammedbenlaiter/projectalter/tree/master/Dtos): contracts · Request and response shapes for auth, search, exchange, messaging, and notifications. · `Dtos`

### Domain model

Persistent entities and database context for the exchange platform.

- [AlterDbContext](https://github.com/mohammedbenlaiter/projectalter/blob/master/Models/AlterDbContext.cs): db context · Entity Framework database context tying the domain model together. · `Models/AlterDbContext.cs`
- [Domain entities](https://github.com/mohammedbenlaiter/projectalter/tree/master/Models): entities · Persistent business objects such as users, skills, requests, offers, exchanges, messages, feedback, and wishlists. · `Models`

### Real-time chat

SignalR hub for live messaging alongside persisted message history.

- [ChatHub](https://github.com/mohammedbenlaiter/projectalter/blob/master/Hubs/ChatHub.cs): signalr hub · Real-time messaging endpoint for live chat and updates. · `Hubs/ChatHub.cs`

### UI shell

Minimal Razor/MVC pages and shared static assets.

- [Home](https://github.com/mohammedbenlaiter/projectalter/blob/master/Controllers/HomeController.cs): mvc controller · Serves the small Razor/MVC entry pages. · `Controllers/HomeController.cs`
- [Razor views](https://github.com/mohammedbenlaiter/projectalter/tree/master/Views): mvc views · Server-rendered pages for the home flow and shared layout. · `Views`
- [Static assets](https://github.com/mohammedbenlaiter/projectalter/tree/master/wwwroot): web assets · Bootstrap, jQuery, and browser scripts/styles served by the app. · `wwwroot`

### Bootstrap & config

Application startup, authentication wiring, and environment configuration.

- [Program.cs](https://github.com/mohammedbenlaiter/projectalter/blob/master/Program.cs): startup · Composition root that wires middleware, services, endpoints, and hosting. · `Program.cs`
- [Auth config](https://github.com/mohammedbenlaiter/projectalter/blob/master/ConfigureAuthentication.cs): authentication setup · Configures JWT authentication and related security wiring. · `ConfigureAuthentication.cs`
- [JWT middleware](https://github.com/mohammedbenlaiter/projectalter/blob/master/Helpers/JwtMiddleware.cs): security middleware · Validates bearer tokens and establishes authenticated user context. · `Helpers/JwtMiddleware.cs`

## Connections

- Program.cs → Auth config: configures · Registers authentication and security services.
- Program.cs → JWT middleware: adds · Includes token validation in the request pipeline.
- Program.cs → AlterDbContext: wires · Adds persistence services and database access.
- Program.cs → Users: maps · Exposes controller endpoints.
- Program.cs → Skills: maps · Exposes controller endpoints.
- Program.cs → Requests: maps · Exposes controller endpoints.
- Program.cs → Offers: maps · Exposes controller endpoints.
- Program.cs → Exchanges: maps · Exposes controller endpoints.
- Program.cs → Messages: maps · Exposes controller endpoints.
- Program.cs → Feedback: maps · Exposes controller endpoints.
- Program.cs → Certifications: maps · Exposes controller endpoints.
- Program.cs → Wishlists: maps · Exposes controller endpoints.
- Program.cs → Home: maps · Exposes MVC pages.
- Program.cs → ChatHub: maps · Hosts the real-time hub endpoint.
- Home → Razor views: renders · Serves Razor pages and shared layout.
- Home → Static assets: uses · Loads browser scripts and styles.
- Users → DTO contracts: uses · Consumes auth and user request/response contracts.
- Skills → DTO contracts: uses · Consumes skill and search contracts.
- Requests → DTO contracts: uses · Consumes request contracts.
- Offers → DTO contracts: uses · Consumes offer contracts.
- Exchanges → DTO contracts: uses · Consumes exchange and notification contracts.
- Messages → DTO contracts: uses · Consumes message contracts.
- Feedback → DTO contracts: uses · Consumes feedback contracts.
- Certifications → DTO contracts: uses · Consumes certification contracts.
- Wishlists → DTO contracts: uses · Consumes wishlist contracts.
- DTO contracts → Domain entities: maps to · Separates external payloads from persistence models.
- AlterDbContext → Domain entities: tracks · Manages the core persistent entities.
- Messages → AlterDbContext: persists · Stores and retrieves message history.
- Exchanges → AlterDbContext: updates · Mutates exchange state in storage.
- ChatHub → Messages: shares data · Real-time chat complements persisted messaging.
- ChatHub → AlterDbContext: persists · Can write message activity to storage.
- Users → AlterDbContext: authenticates · Creates and validates user accounts through the data model.
- Feedback → AlterDbContext: stores · Writes feedback records tied to exchanges and users.
