# Finlytic Backend Gateway Finlytic Backend is the central ASP.NET Core Web API gateway and SignalR real-time broker for the Finlytic ecosystem. It serves external clients (`FinlyticApp`, `FinlyticWeb`) via REST endpoints and WebSockets, while interfacing internally with background microservices strictly via MQTT. --- ## Architecture & Responsibilities 1. **Single Public Entrypoint**: - The **only** backend microservice hosting Kestrel HTTP REST and SignalR WebSocket endpoints. 2. **JWT Authentication & User Management**: - Manages user registration, login, JWT token issuance (`IJwtTokenService`), and role-based access control (Admin, Premium, User). 3. **SignalR Real-Time Hubs**: - **`NewsHub`** (`/hubs/news`): Broadcasts live news articles and sentiment classifications. - **`TradeHub`** (`/hubs/trade-updates`): Broadcasts live trade proposals and position updates. - **`TradeRealtimeHub`** (`/hubs/trades`): Legacy real-time trade signals hub. 4. **MQTT Bridge (`BackendMqttBridge` & `WebMqttClient`)**: - Subscribes to internal MQTT topics (`finlytic/news/#`, `finlytic/sentiment/#`, `finlytic/trades/#`, `finlytic/fundamentals/#`, `finlytic/ta/#`). - Forwards MQTT messages to connected SignalR WebSockets and executes MQTT RPC requests for REST controllers. --- ## Feature Status ### Implemented Features - [x] JWT Authentication & User Persistence (`BackendDbContext`). - [x] REST Controllers: `AuthController`, `NewsController`, `AssetsController`, `UserTradesController`, `UserFavoritesController`, `AdminController`. - [x] SignalR WebSockets for News & Trades (`NewsHub`, `TradeHub`). - [x] MQTT Bridge & RPC Gateway Client (`BackendMqttBridge`, `WebMqttClient`). - [x] Complete removal of mock data in REST responses. ### Planned Features - [ ] OAuth2 / Social Login integration (Google / Apple Sign-In). - [ ] Two-Factor Authentication (2FA / TOTP).