Skip to content

Latest commit

 

History

History
314 lines (239 loc) · 8.46 KB

File metadata and controls

314 lines (239 loc) · 8.46 KB

💬 Logic Dynamics Chat

Real-time • Secure • Fast
A full-stack chat application built with .NET 10, SignalR, and .NET MAUI — deployed to a live VPS with HTTPS.

Logic Dynamics .NET 10 SignalR MAUI License


🚀 Live Demo

Service URL
🌐 API (Production) https://chat-api.logicdynamics.net
📡 SignalR Hub https://chat-api.logicdynamics.net/hubs/chat
📄 API Schema https://chat-api.logicdynamics.net/openapi/v1.json

✨ Features

  • Real-time messaging via SignalR WebSockets
  • 💬 Chat bubbles — sent (right, blue) vs received (left, dark)
  • 🏠 Room-based chat — join any named room
  • 💾 Message persistence — EF Core + SQLite
  • 🔒 HTTPS — SSL via Let's Encrypt
  • 🌍 Cross-platform — Windows, Android, iOS, macOS
  • 🎨 Logic Dynamics branded UI — deep navy, cyber cyan, signal red
  • 👥 Multi-user — unlimited users per room
  • 🔄 Auto-reconnect — SignalR handles dropped connections

🏗️ Architecture

┌─────────────────────────────────────────────────────┐
│              .NET MAUI Client                        │
│   ChatPage ──► ChatViewModel ──► ChatService         │
│                                      │               │
│                   SignalR Client SDK │               │
└──────────────────────────────────────┼───────────────┘
                                       │ WebSocket (WSS)
                                ┌──────▼──────────────┐
                                │   ASP.NET Core       │
                                │   Web API (.NET 10)  │
                                │                      │
                                │  /hubs/chat          │
                                │       ▼              │
                                │   ChatHub            │
                                │       ▼              │
                                │  /api/messages       │
                                │       ▼              │
                                │   EF Core            │
                                │       ▼              │
                                │   SQLite DB          │
                                └──────────────────────┘
                                       │
                                ┌──────▼──────────────┐
                                │   Ubuntu 24 VPS      │
                                │   Nginx (reverse     │
                                │   proxy + SSL)       │
                                │   systemd service    │
                                └──────────────────────┘

🗂️ Solution Structure

ChatApp.sln
├── ChatApp.API/              → ASP.NET Core Web API (.NET 10)
│   ├── Data/
│   │   └── ChatDbContext.cs
│   ├── Hubs/
│   │   └── ChatHub.cs
│   ├── Repositories/
│   │   ├── IMessageRepository.cs
│   │   └── MessageRepository.cs
│   ├── Endpoints/
│   │   └── MessageEndpoints.cs
│   └── Program.cs
│
├── ChatApp.MAUI/             → .NET MAUI Cross-Platform Client
│   ├── Services/
│   │   └── ChatService.cs
│   ├── ViewModels/
│   │   └── ChatViewModel.cs
│   ├── Views/
│   │   └── ChatPage.xaml
│   └── Resources/
│       └── Images/
│           └── ld_logo.png
│
└── ChatApp.Shared/           → Shared Models & DTOs
    ├── Models/
    │   └── ChatMessage.cs
    └── DTOs/
        └── MessageDtos.cs

🛠️ Tech Stack

Layer Technology
Runtime .NET 10
Backend ASP.NET Core Web API
Real-time SignalR (WebSockets)
Database SQLite + Entity Framework Core
Client .NET MAUI
Pattern MVVM + Repository
Server Ubuntu 24 VPS (Hostinger)
Proxy Nginx
SSL Let's Encrypt (Certbot)
Process systemd

⚡ Quick Start

Prerequisites

dotnet workload install maui

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/chatapp-logicdynamics.git
cd chatapp-logicdynamics

2. Add project references

dotnet add ChatApp.API reference ChatApp.Shared
dotnet add ChatApp.MAUI reference ChatApp.Shared

3. Run the API

cd ChatApp.API
dotnet run
# API running at http://localhost:5246

4. Run the MAUI App

Open a new terminal:

cd ChatApp.MAUI
dotnet run -f net10.0-windows10.0.19041.0

5. Chat!

  • Enter your name
  • Enter a Room ID (e.g. general)
  • Click ⚡ JOIN ROOM
  • Open a second instance with a different name — real-time chat! 🔥

🌐 Deploying to VPS

Publish the API

cd ChatApp.API
dotnet publish -c Release -o ./publish

Upload to server

scp -r ./publish/* root@YOUR_VPS_IP:/var/www/chatapp-api/

systemd Service

Create /etc/systemd/system/chatapp-api.service:

[Unit]
Description=Logic Dynamics Chat API
After=network.target

[Service]
WorkingDirectory=/var/www/chatapp-api
ExecStart=/root/.dotnet/dotnet ChatApp.API.dll --urls "http://0.0.0.0:5246"
Restart=always
RestartSec=10
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_ROOT=/root/.dotnet

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable chatapp-api
systemctl start chatapp-api

Nginx Config

server {
    listen 80;
    server_name chat-api.yourdomain.com;

    location / {
        proxy_pass http://localhost:5246;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

SSL Certificate

certbot --nginx -d chat-api.yourdomain.com

📡 API Reference

SignalR Hub — /hubs/chat

Method Parameters Description
JoinRoom roomId, userName Join a chat room
SendMessage roomId, senderName, content Send a message
LeaveRoom roomId Leave a chat room

Client listener:

connection.On<ChatMessage>("ReceiveMessage", msg => {
    // Handle incoming message
});

REST Endpoints

Method Endpoint Description
GET /api/messages/{roomId} Get room message history

🎨 Design System

Token Color Usage
Deep Navy #0A0F1E Background
LD Blue #0057FF Primary / Sent bubbles
Cyber Cyan #00D4FF Accents / Headers
Signal Red #FF003C Logo / Alerts
Dark Card #0D1B3E Received bubbles

🔑 Key Learnings

Building this project covers:

  • SignalR — WebSocket hub, groups, connection lifecycle
  • Entity Framework Core — SQLite, migrations, repository pattern
  • Minimal APIs — endpoint mapping, OpenAPI
  • MAUI MVVM — data binding, ObservableCollection, ICommand
  • Linux DevOps — systemd, Nginx, SSL, VPS deployment
  • Clean Architecture — Shared contracts, separation of concerns

📁 Related Projects

Check out more Logic Dynamics projects at logicdynamics.net


📄 License

MIT License — see LICENSE for details.


Built with 🔥 by Logic Dynamics

Code. Build. Innovate.