# mohamedroshdyp/chatapp-back architecture

> Architecture diagram of the GitHub repository mohamedroshdyp/chatapp-back, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohamedroshdyp/chatapp-back
- Repository: https://github.com/mohamedroshdyp/chatapp-back

## Overview

##### Project type and purpose
- This is a full-stack .NET Core Chat Application. It exposes a REST/SignalR API (“Presentation/API/ChatApp.API”), implements business logic with a CQRS approach in the Application layer (“src/Core/ChatApp.Application”), defines core domain entities (“src/Core/ChatApp.Domain”), and handles data persistence via Entity Framework Core in the Persistence layer (“src/Infrastructure/ChatApp.Persistence”).
- Features include: user registration/login, profile/photo management, real-time messaging (SignalR hubs), message liking, admin role management, pagination, and JWT/token services.

##### File structure
- Top‐level solution groups by layer:
- Core
– Domain: Entities & base classes
– Application: CQRS commands/queries, DTOs, validators, mapping profiles, repositories interfaces, dependency‐injection
- Infrastructure
– Persistence: EF Core DbContext, Migrations, Seed data, Repository implementations, token service, photo manager
- Presentation (API)
– Controllers: Accounts, Messages, Likes, Admin
– SignalR: MessageHub, PresenceHub, PresenceTracker
– Program.cs & appsettings
- This layering enforces Clean/Onion architecture: Presentation → Application → Domain → Infrastructure.
- Look for “DependancyInjection” files in Application & Persistence—they register services.

##### Extract insights from README
- README only contains the title, so rely on file structure and naming conventions to infer the architecture and technologies (ASP.NET Core Web API, EF Core, SignalR, AutoMapper, MediatR-like CQRS).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Clients"
        Client("Web/Mobile SPA"):::external
    end

    subgraph "API Layer"
        direction TB
        AC["AccountsController"]:::frontend
        MC["MessagesController"]:::frontend
        LC["LikesController"]:::frontend
        AdminC["AdminController"]:::frontend
        BC["BaseController"]:::frontend
        MH["MessageHub"]:::frontend
        PH["PresenceHub"]:::frontend
        PT["PresenceTracker"]:::frontend
        Prog["Program.cs"]:::frontend
        Settings["appsettings.json/.Development.json"]:::frontend
    end

    subgraph "Application Layer"
        direction TB
        DIApp["DependancyInjection.cs"]:::application
        subgraph "CQRS Features"
            ACCFeat["Accounts Features"]:::application
            ADMFeat["Admin Features"]:::application
            LKSFeat["Likes Features"]:::application
            MSGFeat["Message Features"]:::application
        end
        Val["Validators"]:::application
        Map["MappingProfile.cs"]:::application
        Contracts["Persistence Contracts"]:::application
        HelpersApp["Helpers"]:::application
    end

    subgraph "Domain Layer"
        direction TB
        Entities["Entities & BaseEntity"]:::domain
    end

    subgraph "Persistence Layer"
        direction TB
        DIPers["DependancyInjection.cs"]:::persistence
        DbCtx["ApplicationDbContext"]:::persistence
        Migrations["Migrations"]:::persistence
        Seed["Seed Configurations"]:::persistence
        Repos["Repository Implementations"]:::persistence
        PhotoMgr["PhotoManager.cs"]:::persistence
    end

    subgraph "External Services"
        direction TB
        Blob["Blob Storage"]:::external
    end

    DB[(Database)]:::db

    Client -->|"HTTP/REST"| AC
    Client -->|"HTTP/REST"| MC
    Client -->|"HTTP/REST"| LC
    Client -->|"HTTP/REST"| AdminC
    Client -->|"WebSocket/SignalR"| MH
    Client -->|"WebSocket/SignalR"| PH

    AC -->|"calls"| DIApp
    MC -->|"calls"| DIApp
    LC -->|"calls"| DIApp
    AdminC -->|"calls"| DIApp
    MH -->|"calls"| DIApp
    PH -->|"calls"| DIApp

    DIApp --> ACCFeat
    DIApp --> ADMFeat
    DIApp --> LKSFeat
    DIApp --> MSGFeat

    ACCFeat --> Val
    MSGFeat --> Val
    ADMFeat --> Val
    LKSFeat --> Val

    ACCFeat --> Map
    MSGFeat --> Map
    ADMFeat --> Map
    LKSFeat --> Map

    ACCFeat --> Contracts
    ADMFeat --> Contracts
    LKSFeat --> Contracts
    MSGFeat --> Contracts

    ACCFeat --> Entities
    ADMFeat --> Entities
    LKSFeat --> Entities
    MSGFeat --> Entities

    Contracts --> DIPers
    HelpersApp --> DIPers

    DIPers --> DbCtx
    DIPers --> Repos

    Repos --> DbCtx
    DbCtx --> Migrations
    DbCtx --> Seed
    DbCtx --> DB

    PhotoMgr --> Blob

    click AC "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/Controllers/AccountsController.cs"
    click MC "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/Controllers/MessagesController.cs"
    click LC "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/Controllers/LikesController.cs"
    click AdminC "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/Controllers/AdminController.cs"
    click BC "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/Controllers/BaseController.cs"
    click MH "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/SignalR/MessageHub.cs"
    click PH "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/SignalR/PresenceHub.cs"
    click PT "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/SignalR/PresenceTracker.cs"
    click Prog "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/Program.cs"
    click Settings "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/appsettings.json"
    click Settings "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Presentation/API/ChatApp.API/appsettings.Development.json"
    click DIApp "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Core/ChatApp.Application/DependancyInjection.cs"
    click ACCFeat "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Core/ChatApp.Application/Features/Accounts"
    click ADMFeat "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Core/ChatApp.Application/Features/Admin"
    click LKSFeat "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Core/ChatApp.Application/Features/Likes"
    click MSGFeat "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Core/ChatApp.Application/Features/Message"
    click Val "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Core/ChatApp.Application/Features/Accounts/Command/Register/RegisterValidator.cs"
    click Val "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Core/ChatApp.Application/Features/Message/Validator/MessageValidator.cs"
    click Map "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Core/ChatApp.Application/MappingProfiles/MappingProfile.cs"
    click Contracts "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Core/ChatApp.Application/Persistence/Contracts"
    click HelpersApp "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Core/ChatApp.Application/Helper"
    click DIPers "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Infrastructure/ChatApp.Persistence/DependancyInjection.cs"
    click DbCtx "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Infrastructure/ChatApp.Persistence/DatabaseContext/ApplicationDbContext.cs"
    click Migrations "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Infrastructure/ChatApp.Persistence/Migrations"
    click Seed "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Infrastructure/ChatApp.Persistence/Configuration/Entities"
    click Repos "https://github.com/mohamedroshdyp/chatapp-back/tree/master/src/Infrastructure/ChatApp.Persistence/Repositories"
    click PhotoMgr "https://github.com/mohamedroshdyp/chatapp-back/blob/master/src/Infrastructure/ChatApp.Persistence/Helpers/PhotoManager.cs"

    classDef frontend fill:#93c5fd,stroke:#1e40af,color:#1e40af;
    classDef application fill:#86efac,stroke:#166534,color:#166534;
    classDef domain fill:#d1d5db,stroke:#374151,color:#374151;
    classDef persistence fill:#fdba74,stroke:#c2410c,color:#c2410c;
    classDef external fill:#facc15,stroke:#a16207,color:#a16207,stroke-dasharray: 5 5;
    classDef db fill:#f87171,stroke:#991b1b,color:#991b1b,stroke-width:2px;
```
