# boburrustamov/telegram-clone architecture

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

- Interactive diagram: https://gitdiagram.com/boburrustamov/telegram-clone
- Repository: https://github.com/boburrustamov/telegram-clone

## Overview

ChatApp is a web chat product with a React client and ASP.NET Core API. Users enter through the routed web app, then use chat, channel, account, and call features; the API delegates domain operations to infrastructure services backed by Entity Framework. The tree also documents messaging, reactions, files, administration, and real-time chat. Source evidence is limited to the supplied index and excerpts; unsampled client/API wiring is omitted or marked unverified.

Main entry points: [`backend/ChatApp.Infrastructure/Data/AppDbContext.cs`](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Data/AppDbContext.cs) (Application data), [`backend/ChatApp.Infrastructure/Services/ChatService.cs`](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/ChatService.cs) (Chat service), [`backend/ChatApp.Infrastructure/Services/MessageService.cs`](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/MessageService.cs) (Message service), [`backend/ChatApp.API/Controllers/MessagesController.cs`](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Controllers/MessagesController.cs) (HTTP controllers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_app["Web app<br/>[App.tsx]"]
  node_router["App routes<br/>[AppRouter.tsx]"]
  node_chatpage["Chat page<br/>[ChatPage.tsx]"]
  node_callui["Call interface<br/>[CallOverlay.tsx]"]
  node_webrtc["WebRTC service<br/>[webrtcService.ts]"]
end

subgraph group_api["API and realtime"]
  node_controllers["HTTP controllers"]
  node_channelscontroller["Channel controller"]
  node_admincontroller["Admin controller<br/>[AdminController.cs]"]
  node_hub["Chat hub<br/>[ChatHub.cs]"]
  node_program["API startup<br/>[Program.cs]"]
end

subgraph group_domain["Domain services"]
  node_chatservice["Chat service<br/>[ChatService.cs]"]
  node_messageservice["Message service<br/>[MessageService.cs]"]
  node_channelservice["Channel service<br/>[ChannelService.cs]"]
  node_authservice["Authentication<br/>[AuthService.cs]"]
  node_userservice["User service<br/>[UserService.cs]"]
  node_callservice["Call service<br/>[CallService.cs]"]
  node_fileandreaction["Files and reactions<br/>[FileService.cs]"]
end

subgraph group_data["Persistence"]
  node_database[("Application data<br/>[AppDbContext.cs]")]
end

node_user(("User"))

node_user -.->|"opens"| node_app
node_app -->|"renders"| node_router
node_router -.->|"routes to"| node_chatpage
node_user -.->|"starts calls"| node_callui
node_callui -.->|"uses"| node_webrtc
node_controllers -.->|"delegates"| node_chatservice
node_controllers -->|"delegates"| node_messageservice
node_channelscontroller -->|"delegates"| node_channelservice
node_admincontroller -->|"delegates"| node_userservice
node_admincontroller -->|"delegates"| node_chatservice
node_messageservice -->|"checks membership"| node_chatservice
node_authservice -->|"reads and writes"| node_database
node_channelservice -->|"reads and writes"| node_database
node_chatservice -->|"reads and writes"| node_database
node_messageservice -->|"reads and writes"| node_database
node_program -->|"maps endpoint"| node_hub
node_program -->|"configures"| node_database

click node_app "https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/app/App.tsx"
click node_router "https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/app/routes/AppRouter.tsx"
click node_chatpage "https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/pages/chat/ChatPage.tsx"
click node_callui "https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/features/call/ui/CallOverlay.tsx"
click node_webrtc "https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/features/call/model/webrtcService.ts"
click node_controllers "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Controllers/MessagesController.cs"
click node_channelscontroller "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Controllers/ChannelsController.cs"
click node_admincontroller "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Controllers/AdminController.cs"
click node_hub "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Hubs/ChatHub.cs"
click node_chatservice "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/ChatService.cs"
click node_messageservice "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/MessageService.cs"
click node_channelservice "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/ChannelService.cs"
click node_authservice "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/AuthService.cs"
click node_userservice "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/UserService.cs"
click node_callservice "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/CallService.cs"
click node_fileandreaction "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/FileService.cs"
click node_database "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Data/AppDbContext.cs"
click node_program "https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Program.cs"

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_app,node_router,node_chatpage,node_callui,node_webrtc,node_user toneBlue
class node_controllers,node_channelscontroller,node_admincontroller,node_hub,node_program toneAmber
class node_chatservice,node_messageservice,node_channelservice,node_authservice,node_userservice,node_callservice,node_fileandreaction toneMint
class node_database toneRose
```

## Components

### Web client

- [Web app](https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/app/App.tsx): `frontend/web/src/app/App.tsx`
- [App routes](https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/app/routes/AppRouter.tsx): `frontend/web/src/app/routes/AppRouter.tsx`
- [Chat page](https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/pages/chat/ChatPage.tsx): `frontend/web/src/pages/chat/ChatPage.tsx`
- [Call interface](https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/features/call/ui/CallOverlay.tsx): `frontend/web/src/features/call/ui/CallOverlay.tsx`
- [WebRTC service](https://github.com/boburrustamov/telegram-clone/blob/main/frontend/web/src/features/call/model/webrtcService.ts): `frontend/web/src/features/call/model/webrtcService.ts`

### API and realtime

- [HTTP controllers](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Controllers/MessagesController.cs): `backend/ChatApp.API/Controllers/MessagesController.cs`
- [Channel controller](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Controllers/ChannelsController.cs): `backend/ChatApp.API/Controllers/ChannelsController.cs`
- [Admin controller](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Controllers/AdminController.cs): `backend/ChatApp.API/Controllers/AdminController.cs`
- [Chat hub](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Hubs/ChatHub.cs): `backend/ChatApp.API/Hubs/ChatHub.cs`
- [API startup](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.API/Program.cs): `backend/ChatApp.API/Program.cs`

### Domain services

- [Chat service](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/ChatService.cs): `backend/ChatApp.Infrastructure/Services/ChatService.cs`
- [Message service](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/MessageService.cs): `backend/ChatApp.Infrastructure/Services/MessageService.cs`
- [Channel service](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/ChannelService.cs): `backend/ChatApp.Infrastructure/Services/ChannelService.cs`
- [Authentication](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/AuthService.cs): `backend/ChatApp.Infrastructure/Services/AuthService.cs`
- [User service](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/UserService.cs): `backend/ChatApp.Infrastructure/Services/UserService.cs`
- [Call service](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/CallService.cs): `backend/ChatApp.Infrastructure/Services/CallService.cs`
- [Files and reactions](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Services/FileService.cs): `backend/ChatApp.Infrastructure/Services/FileService.cs`

### Persistence

- [Application data](https://github.com/boburrustamov/telegram-clone/blob/main/backend/ChatApp.Infrastructure/Data/AppDbContext.cs): `backend/ChatApp.Infrastructure/Data/AppDbContext.cs`

### Other components

- **User**

## Connections

- User → Web app: opens
- Web app → App routes: renders (evidence: `frontend/web/src/app/App.tsx`)
- App routes → Chat page: routes to
- User → Call interface: starts calls
- Call interface → WebRTC service: uses
- HTTP controllers → Chat service: delegates
- HTTP controllers → Message service: delegates (evidence: `backend/ChatApp.API/Controllers/MessagesController.cs`)
- Channel controller → Channel service: delegates (evidence: `backend/ChatApp.API/Controllers/ChannelsController.cs`)
- Admin controller → User service: delegates (evidence: `backend/ChatApp.API/Controllers/AdminController.cs`)
- Admin controller → Chat service: delegates (evidence: `backend/ChatApp.API/Controllers/AdminController.cs`)
- Message service → Chat service: checks membership (evidence: `backend/ChatApp.Infrastructure/Services/MessageService.cs`)
- Authentication → Application data: reads and writes (evidence: `backend/ChatApp.Infrastructure/Services/AuthService.cs`)
- Channel service → Application data: reads and writes (evidence: `backend/ChatApp.Infrastructure/Services/ChannelService.cs`)
- Chat service → Application data: reads and writes (evidence: `backend/ChatApp.Infrastructure/Services/ChatService.cs`)
- Message service → Application data: reads and writes (evidence: `backend/ChatApp.Infrastructure/Services/MessageService.cs`)
- API startup → Chat hub: maps endpoint (evidence: `backend/ChatApp.API/Program.cs`)
- API startup → Application data: configures (evidence: `backend/ChatApp.API/Program.cs`)
