# donato381/signalr architecture

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

- Interactive diagram: https://gitdiagram.com/donato381/signalr
- Repository: https://github.com/donato381/signalr

## Overview

ChatSite is a real-time, multi-user chat application. A user connects with a name, receives the current user list and cached or persisted chat history, sends a message that is stored and broadcast to all clients, and is removed from the connected-user list on disconnect. The server uses SignalR hubs and a LINQ-to-SQL context for chat history. The supplied excerpts do not show the browser page’s SignalR calls or the database mapping implementation, so those links are left unverified.

Main entry points: [`ChatSite/ChatSite/ChatHub.cs`](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/ChatHub.cs) (Chat hub), [`ChatSite/ChatSite/index.html`](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/index.html) (Chat page), [`ChatSite/ChatSite/Scripts/jquery.signalR-2.1.2.js`](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Scripts/jquery.signalR-2.1.2.js) (SignalR client), [`ChatSite/ChatSite/Startup.cs`](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Startup.cs) (SignalR setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_page["Chat page<br/>[index.html]"]
  node_signalrjs["SignalR client"]
end

subgraph group_realtime["Realtime server"]
  node_startup["SignalR setup<br/>[Startup.cs]"]
  node_hub["Chat hub<br/>[ChatHub.cs]"]
  node_sessionstate["Users and cache<br/>[ChatHub.cs]"]
  node_message["Chat message model<br/>[ChatHub.cs]"]
end

subgraph group_persistence["Chat persistence"]
  node_datacontext["LINQ data context<br/>[Chat.designer.cs]"]
  node_historyextension["History entity extension<br/>[Chat.cs]"]
  node_database[("Chat history store")]
end

node_user(("Chat user"))

node_user -.->|"uses"| node_page
node_page -.->|"uses"| node_signalrjs
node_signalrjs -.->|"connects"| node_startup
node_startup -.->|"maps SignalR"| node_hub
node_hub -->|"tracks users"| node_sessionstate
node_hub -->|"builds messages"| node_message
node_hub -->|"queries and saves"| node_datacontext
node_datacontext -.->|"reads and writes"| node_database

click node_page "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/index.html"
click node_signalrjs "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Scripts/jquery.signalR-2.1.2.js"
click node_startup "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Startup.cs"
click node_hub "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/ChatHub.cs"
click node_sessionstate "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/ChatHub.cs"
click node_message "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/ChatHub.cs"
click node_datacontext "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Chat.designer.cs"
click node_historyextension "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Chat.cs"
click node_database "https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Chats%20DB%20Script.sql"

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_page,node_signalrjs,node_user toneBlue
class node_startup,node_hub,node_sessionstate,node_message toneAmber
class node_datacontext,node_historyextension,node_database toneMint
```

## Components

### Browser client

- [Chat page](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/index.html): `ChatSite/ChatSite/index.html`
- [SignalR client](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Scripts/jquery.signalR-2.1.2.js): `ChatSite/ChatSite/Scripts/jquery.signalR-2.1.2.js`

### Realtime server

- [SignalR setup](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Startup.cs): `ChatSite/ChatSite/Startup.cs`
- [Chat hub](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/ChatHub.cs): `ChatSite/ChatSite/ChatHub.cs`
- [Users and cache](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/ChatHub.cs): `ChatSite/ChatSite/ChatHub.cs`
- [Chat message model](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/ChatHub.cs): `ChatSite/ChatSite/ChatHub.cs`

### Chat persistence

- [LINQ data context](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Chat.designer.cs): `ChatSite/ChatSite/Chat.designer.cs`
- [History entity extension](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Chat.cs): `ChatSite/ChatSite/Chat.cs`
- [Chat history store](https://github.com/donato381/signalr/blob/master/ChatSite/ChatSite/Chats%20DB%20Script.sql): `ChatSite/ChatSite/Chats DB Script.sql`

### Other components

- **Chat user**

## Connections

- Chat user → Chat page: uses
- Chat page → SignalR client: uses
- SignalR client → SignalR setup: connects
- SignalR setup → Chat hub: maps SignalR
- Chat hub → Users and cache: tracks users (evidence: `ChatSite/ChatSite/ChatHub.cs`)
- Chat hub → Chat message model: builds messages (evidence: `ChatSite/ChatSite/ChatHub.cs`)
- Chat hub → LINQ data context: queries and saves (evidence: `ChatSite/ChatSite/ChatHub.cs`)
- LINQ data context → Chat history store: reads and writes
