How lenardmagat/chatengine works
ChatEngine is a SignalR chat backend for a peer-to-peer bartering platform. Its main workflow authenticates a user, initializes or loads a room, and sends messages that are persisted and broadcast; trade negotiations are represented as chat events and offer records. REST account, inventory, and search capabilities form related branches, while background workers synchronize documents and process offer lifecycles. The README documents chat and trade capabilities beyond the sampled handlers; their exact wiring is not fully verifiable, so uncertain links are omitted.
Main entry points: DataBaseContext.cs Application database · InventoryEventHandler Inventory handlers · AppHub.cs SignalR hub · ChatEventHandler Chat handlers
Components 24
API entry
- REST routers
EndPoints/Routers/FeatureRouters.cs - SignalR hub
EndPoints/Hub/AppHub.cs
Chat and trades
- Chat commands
Services/SystemEvents/ChatEvents.cs - Chat handlers
Services/EventHandlers/ChatEventHandler - Rooms and messages
Datas/Models/ChatRoomModel.cs - Offer commands
Services/SystemEvents/UnifiedProposedOffer.cs - Offer handlers
Services/EventHandlers/OfferingMechanismsHandler - Trade and sale offers
Datas/Models/TradeOfferModel.cs
Accounts and inventory
- Account routers
EndPoints/Routers/AccountRouters - Account handlers
Services/EventHandlers/AccountEventHandler/CreateAccountHandler.cs - Authentication handlers
Services/EventHandlers/AuthEventHandler/LoginCommandHandler.cs - Inventory routers
EndPoints/Routers/InventoryRouter - Inventory handlers
Services/EventHandlers/InventoryEventHandler - Products
Datas/Models/ProductModel.cs
Search indexing
- Search endpoint
EndPoints/Routers/FeatureRouters.cs/SearchRouter.cs - Search strategies
Services/EventHandlers/SearchEventHandler.cs/ProductSearchHandler.cs - MeiliSearch service
Services/EventsServices/MeiliSearchServices.cs - Index sync worker
BackGroundWorkers/MeiliSyncWorker.cs - Document handlers
Services/EventHandlers/BackgroundWorkerHandler/DocumentationEventHandler
Persistence and security
- Application database
Infrastructure/DataBase/DataBaseContext.cs - JWT services
Services/EventsServices/JwtAuthServices.cs - Token creation
Infrastructure/Security/JwtTokenServices.cs
Other components
- User client
- MeiliSearch
Connections 25
- User client → SignalR hub: connects and sends
- User client → REST routers: calls REST
- SignalR hub → Chat commands: dispatches
- Chat commands → Chat handlers: handled by
- Chat handlers → Application database: reads and writes
- Chat handlers → Rooms and messages: creates chat data
- SignalR hub → Offer handlers: offer actions
- Offer handlers → Application database: reads and writes
- Offer handlers → Trade and sale offers: updates offers
- Account routers → Account handlers: dispatches
- Account routers → Authentication handlers: dispatches
- Account handlers → Application database: reads and writes
- Authentication handlers → JWT services: issues tokens
- JWT services → Token creation: creates tokens
- JWT services → Application database: stores refresh tokens
- Inventory routers → Inventory handlers: dispatches
- Inventory handlers → Application database: reads and writes
- Inventory handlers → Products: manages products
- Search endpoint → Search strategies: dispatches query
- Search strategies → MeiliSearch service: searches index
- MeiliSearch service → MeiliSearch: queries and indexes
- Index sync worker → Application database: reads outbox
- Index sync worker → Document handlers: dispatches documents
- Document handlers → MeiliSearch service: indexes documents
- Inventory handlers → Application database: records outbox entries