ChatStream
Real-time group chat with SignalR — rooms, presence, message history, typing indicators
About This Project
A production real-time chat system built with ASP.NET Core SignalR. Features group chat rooms, online presence tracking, typing indicators, message history with cursor pagination, message delivery acknowledgement, and Redis backplane for horizontal scaling. Shows the correct patterns for multi-server SignalR deployments.
What You'll Learn
Key Features
Project Structure
ChatStream/ ├── src/ │ ├── ChatStream.Api/ # SignalR hub, REST endpoints, DI │ ├── ChatStream.Application/ # Message commands, presence service │ ├── ChatStream.Domain/ # Room, Message, Participant entities │ └── ChatStream.Infrastructure/ # EF Core, Redis presence, backplane ├── tests/ │ └── ChatStream.Integration/ # Hub integration tests with TestServer ├── test-client/ │ └── index.html # Browser-based test client └── docker-compose.yml
Setup Guide
Clone and start infrastructure
Start PostgreSQL and Redis via Docker Compose.
git clone https://github.com/asmanasir/ChatStream.git cd ChatStream docker-compose up -d
Run migrations and seed rooms
Create the messages schema and seed two default chat rooms.
dotnet ef database update dotnet run --project src/ChatStream.Api -- --seed
Running the Project
Run the API
Start the API. Connect to /hubs/chat with a SignalR client.
dotnet run --project src/ChatStream.Api
Connect with the test client
Open the included HTML test client to send and receive messages.
# Open test client in browser
open http://localhost:5000/test-client
# Or connect via the @microsoft/signalr JS client:
const conn = new HubConnectionBuilder()
.withUrl("/hubs/chat?access_token=<jwt>")
.withHubProtocol(new MessagePackHubProtocol())
.withAutomaticReconnect()
.build();
await conn.start();
await conn.invoke("JoinRoom", "general");Project Info
Tech Stack
Prerequisites
- .NET 9 SDK installed
- Docker Desktop installed
- Basic understanding of WebSockets or SignalR
Learnixo
Project Author
Most SignalR tutorials run on a single server and break the moment you add a second instance. ChatStream starts with the Redis backplane and shows the presence, typing, and reconnection patterns that actually work in production.