ChaoticCupid is a real-time matchmaking simulation system built on .NET 8. It demonstrates modern distributed application patterns - asynchronous communication, background processing, and thread-safe state management - through a PubSub architecture powered by ASP.NET Core SignalR.
The project follows a decoupled client-server model using WebSockets for low-latency, bi-directional communication.
The backbone of the system, responsible for orchestration and business logic:
- Registry Management - a centralized, thread-safe
PersonRegistrytracks all active users - SignalR Hub -
CupidHubmanages connection lifecycle and exposes the client-facing interface - Background Orchestrator -
CupidServiceruns independently of the request cycle, executing matchmaking every 60 seconds
A terminal-based interface built for clarity:
- Rich UI - powered by
Spectre.Consolewith colored panels, styled prompts, and a FigletText banner - Command Input - custom keystroke handler with tab-completion for
/block - State Management - tracks pending letter confirmation and blocked users locally
PersonRegistry uses manual lock blocks to prevent race conditions during concurrent registrations and disconnections, ensuring data integrity throughout the matchmaking cycle.
Candidates are scored against each recipient using a weighted system:
| Factor | Points |
|---|---|
| Same city | +30 |
| Age within ±2 years | +20 |
| Cryptographic random factor | +0 to 100 |
The candidate with the highest score becomes the letter sender. The random element is generated via RandomNumberGenerator (System.Security.Cryptography) - the modern equivalent of RNGCryptoServiceProvider.
- On startup, the client retries every 3 seconds until the server responds
- If the server drops during a session, a
Closedevent notifies the user to restart - Automatic reconnect is intentionally disabled - the server holds state in memory and would not recognize a reconnected client
ChaoticCupid je sistem za simulaciju provodadžisanja u realnom vremenu, izgrađen na .NET 8 platformi. Projekat demonstrira moderne obrasce distribuiranih aplikacija - asinhronu komunikaciju, pozadinsku obradu i bezbedno upravljanje stanjem u višenitnom okruženju - kroz PubSub arhitekturu zasnovanu na ASP.NET Core SignalR-u.
Projekat koristi razdvojenu klijent-server arhitekturu uz WebSocket konekciju za dvosmernu komunikaciju sa niskim kašnjenjem.
Okosnica sistema zadužena za orkestraciju i poslovnu logiku:
- Upravljanje Registrom - centralizovani, thread-safe
PersonRegistryprati sve aktivne korisnike - SignalR Hub -
CupidHubupravlja životnim ciklusom konekcija i pruža interfejs za klijente - Pozadinski Orkestrator -
CupidServiceradi nezavisno od request ciklusa i izvršava mečovanje svakih 60 sekundi
Terminalni interfejs izgrađen za jasnoću i upotrebljivost:
- Bogati UI -
Spectre.Consolesa obojenim panelima, stilizovanim promptovima i FigletText bannerom - Unos Komandi - prilagođeni hendler sa tab-completion podrškom za
/block - Praćenje Stanja - lokalno upravljanje potvrdom pisama i listom blokiranih korisnika
PersonRegistry koristi lock blokove za sprečavanje race condition situacija tokom istovremenih registracija i diskonekcija, čuvajući integritet podataka tokom celog ciklusa mečovanja.
Kandidati se boduju u odnosu na svakog primaoca prema sledećem sistemu:
| Faktor | Poeni |
|---|---|
| Isti grad | +30 |
| Godište u rasponu ±2 | +20 |
| Kriptografski nasumični faktor | +0 do 100 |
Kandidat sa najvišim skorom postaje pošiljalac pisma. Nasumični element generiše RandomNumberGenerator (System.Security.Cryptography) - moderna zamena za RNGCryptoServiceProvider.
- Pri pokretanju, klijent pokušava konekciju svakih 3 sekunde dok server ne odgovori
- Ako server padne tokom sesije,
Closedevent obaveštava korisnika da ponovo pokrene aplikaciju - Automatski reconnect je namerno isključen - server čuva stanje u memoriji i ne bi prepoznao ponovo konektovanog klijenta
- .NET 8.0 SDK
1. Clone the repository / Kloniraj repozitorijum
git clone git@github.com:ljubogdan/chaotic-cupid.git
cd chaotic-cupid2. Launch the server / Pokreni server
dotnet run --project ChaoticCupid.ServerServer listens on http://localhost:5104.
3. Launch a client / Pokreni klijent
dotnet run --project ChaoticCupid.ClientEach client runs in a separate terminal window.