# kayamuhammet/realtimechat architecture

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

- Interactive diagram: https://gitdiagram.com/kayamuhammet/realtimechat
- Repository: https://github.com/kayamuhammet/realtimechat

## Overview

##### Project type and purpose
- Type: Full-stack Real-Time Chat Application
- Backend: .NET Core 7 Web API + Entity Framework Core + SignalR + SQLite
- Frontend: Angular 19 + TypeScript + SignalR Client + RxJS
- Purpose: general & private messaging, user presence, message history

##### File structure
- Top-level folders
- ChatApp.Api – backend service (Controllers, Hubs, Data/EF Core, Models, configuration, migrations)
- ChatApp.Frontend – Angular SPA (components under src/app: chat, user-list; signalr service; config; assets)
- Key backend subfolders
- Controllers: HTTP endpoints (e.g., ChatController for history, maybe auth)
- Hubs: ChatHub for real-time WebSocket connections
- Data: AppDbContext + Migrations for SQLite schema
- Models: ChatMessage, User, UserStatus
- Key frontend files
- signalr.service.ts – establishes & manages the SignalR connection
- chat.component.ts/html/css – UI for messages
- user-list.component.ts/html/css – displays online users

##### README
- Confirms real-time messaging via SignalR
- Lists features (authentication, general & private chat, history, presence)
- Reveals tech stack

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        AngularApp["Angular Application"]:::frontend
        ChatComponent["Chat UI Component"]:::frontend
        UserListComponent["User List Component"]:::frontend
        SignalRService["SignalR Client Service"]:::frontend
        AppConfig["App Configuration"]:::frontend
        EntryPoint["Main Entry Point"]:::frontend
    end

    %% API Server Layer
    subgraph "API Server"
        direction TB
        ChatController["ChatController (REST)"]:::backend
        ChatHub["ChatHub (SignalR)"]:::realtime
        Startup["Program & Config"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        AppDbContext["AppDbContext"]:::backend
        SQLiteDB["SQLite Database"]:::db
        Migrations["EF Core Migrations"]:::tool
    end

    %% Connections
    AngularApp -->|HTTP GET/POST| ChatController
    ChatComponent -->|uses| SignalRService
    UserListComponent -->|uses| SignalRService
    SignalRService -.WebSocket.-> ChatHub
    ChatController -->|EF Core CRUD| AppDbContext
    ChatHub -->|EF Core Persist| AppDbContext
    AppDbContext -->|reads/writes| SQLiteDB
    Migrations -->|updates schema| AppDbContext
    ChatHub -->|broadcast| AngularApp

    %% Click Events
    click AngularApp "https://github.com/kayamuhammet/realtimechat/tree/main/ChatApp.Frontend/src/app"
    click ChatComponent "https://github.com/kayamuhammet/realtimechat/blob/main/ChatApp.Frontend/src/app/chat/chat.component.ts"
    click UserListComponent "https://github.com/kayamuhammet/realtimechat/blob/main/ChatApp.Frontend/src/app/user-list/user-list.component.ts"
    click SignalRService "https://github.com/kayamuhammet/realtimechat/blob/main/ChatApp.Frontend/src/app/signalr.service.ts"
    click AppConfig "https://github.com/kayamuhammet/realtimechat/blob/main/ChatApp.Frontend/src/app/app.config.ts"
    click EntryPoint "https://github.com/kayamuhammet/realtimechat/blob/main/ChatApp.Frontend/src/main.ts"
    click ChatController "https://github.com/kayamuhammet/realtimechat/blob/main/ChatApp.Api/Controllers/ChatController.cs"
    click ChatHub "https://github.com/kayamuhammet/realtimechat/blob/main/ChatApp.Api/Hubs/ChatHub.cs"
    click AppDbContext "https://github.com/kayamuhammet/realtimechat/blob/main/ChatApp.Api/Data/AppDbContext.cs"
    click Migrations "https://github.com/kayamuhammet/realtimechat/tree/main/ChatApp.Api/Migrations"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#3498DB,color:#1B4F72;
    classDef backend fill:#ABEBC6,stroke:#27AE60,color:#145A32;
    classDef realtime fill:#F9E79F,stroke:#F1C40F,color:#7D6608;
    classDef db fill:#FAD7A0,stroke:#D68910,color:#7E5109;
    classDef tool fill:#D5DBDB,stroke:#A6ACAF,color:#424949;
```
