A modern real-time chat application built with .NET, following Clean Architecture principles.
It supports real-time messaging with SignalR, authentication with JWT & Identity, MongoDB persistence, and integrations like Redis caching and Hangfire jobs.
MyChatApp.sln
├── src
│ ├── Core
│ │ ├── MyChatApp.Domain
│ │ └── MyChatApp.Application
│ ├── Infrastructure
│ │ ├── MyChatApp.Infrastructure.Persistence
│ │ ├── MyChatApp.Infrastructure.Identity
│ │ └── MyChatApp.Infrastructure.Shared
│ └── Presentation
│ └── MyChatApp.WebAPI
└── tests
└── MyChatApp.Application.UnitTests
The solution follows Clean Architecture and CQRS with MediatR.
-
💡 Business entities & rules (
User,Chat,ChatMember,Message,MessageAttachment,MessageDlivery,MessageReation) -
🎭 Enums (
ChatType,MemberRole,MessageType,MessageStatus,NotificationType,PrivacyLevel,UserStatus) -
🔔 Shared (
Result,Error) -
🗂️ Repository Interfaces (
IRepository,IUserRepository,IChatRepository,IMessageRepository)
-
📝 CQRS: Commands & Queries (``)
-
⚡ MediatR Handlers
-
📤 DTOs (``)
-
✅ FluentValidation for request validation
-
🔄 AutoMapper for mapping between domain & DTOs
-
🌐 External Service Interfaces (``)
-
Persistence
-
MongoDB repositories (
MongoDbChatRepository) -
EF Core + Identity (
ApplicationDbContext) -
SQL migrations
-
-
Identity
-
JWT & refresh token service
-
ASP.NET Core Identity customization
-
-
Shared
-
Hangfire jobs (cleanup, notifications)
-
Redis caching (
ICacheService) -
Email & file storage (future extensions)
-
-
🌍 ASP.NET Core Web API + SignalR
-
🎮 Controllers: Thin endpoints calling MediatR
-
🔔 SignalR Hubs (``)
-
⚙️ Program.cs: DI, Swagger, Serilog, CORS, JWT, Hangfire setup
-
🛡️ Middleware: Error handling, rate limiter, logging
-
🔐 Authentication & Authorization (JWT + Identity + refresh tokens)
-
💬 Real-time chat (SignalR for groups & 1-to-1 messaging)
-
📦 MongoDB persistence for chat data
-
🗄️ SQL Server with EF Core for user & role management
-
🚀 CQRS with MediatR for clean use case separation
-
📜 FluentValidation for request validation
-
⚡ Redis caching for performance
-
⏱️ Background jobs with Hangfire
-
📊 Logging with Serilog + structured logs
-
📖 Swagger/OpenAPI documentation
- Unit Tests →
MyChatApp.Application.UnitTests
-
🚧 Basic chat functionality
-
🚧 Authentication & authorization
-
🚧 File sharing (images, docs)
-
🚧 Message search & filters
-
🚧 Push notifications (mobile/web)
Contributions are welcome! Please fork the repo and create a pull request.