How brankonymous/glense works
1. Overall shape
Glense is a microservice system with a React/Vite frontend, a YARP API gateway, four .NET 8 backend services, separate PostgreSQL databases per service, and RabbitMQ for async events. The repo also contains Kubernetes manifests, Dockerfiles, and integration-test projects, so deployment and test boundaries are explicit.
2. Edge layer
The browser app in glense.client/ is the main user entrypoint. It talks to the system through the gateway rather than directly to services. Frontend code is organized around feature components plus a thin API/service layer, which keeps UI state and backend integration separated.
3. API gateway boundary
The gateway routes public traffic by path:
- auth/profile → Account service
- videos/search/playlists/comments/subscriptions → Video Catalogue
- donations/wallets → Donation
- chats/messages → Chat
- /hubs/chat → Chat SignalR hub
It also centralizes CORS and health endpoints, so the browser only needs one base URL.
4. Account service
services/Glense.AccountService owns identity and user-facing account data. It handles registration, login/JWT issuance, profiles, notifications, and an internal API for service-to-service requests. It also exposes a gRPC service for username/profile lookup and consumes RabbitMQ events to create notifications. Its persistence is isolated in its own PostgreSQL database.
5. Video Catalogue service
services/Glense.VideoCatalogue owns videos, uploads, comments, playlists, likes, and subscriptions. It uses EF Core over its own PostgreSQL DB and has a storage abstraction for uploaded video files, with a local-file implementation in the repo. This service also depends on Account over gRPC to resolve usernames and uses RabbitMQ to notify Account about subscription-related events.
6. Donation service
Glense.Server/DonationService owns wallets and donation transfers. It validates recipients through Account’s internal HTTP API, then performs balance changes in its own database. It publishes donation events asynchronously so Account can generate notifications, and it consumes user-registration events to provision wallets for new users.
7. Chat service
services/Glense.ChatService owns chat rooms and messages. It exposes REST controllers for chat/message management and a SignalR hub for real-time messaging. Like the other services, it has a dedicated PostgreSQL database and is deployed independently.
8. Async event bus
RabbitMQ is the main decoupling mechanism between services. The important event flows are:
- Account registration → Donation creates a wallet
- Donation made → Account creates a notification
- User subscribed → Account creates a notification
This keeps user-facing requests from blocking on downstream work.
9. Synchronous internal calls
Not everything is event-driven. Donation performs a synchronous validation call into Account before transferring funds, and Video Catalogue uses gRPC to resolve user data efficiently. Both internal HTTP and gRPC traffic are protected with a shared INTERNAL_API_KEY, which marks them as trusted service-to-service boundaries.
10. Data ownership
Each service owns its schema and DbContext, and the Kubernetes manifests mirror that ownership with separate Postgres deployments, services, and persistent volumes. This makes the architecture strongly bounded: no shared application database, and cross-service reads happen through APIs or events rather than direct DB access.
11. Runtime, deployment, and test seams
The repo supports local Docker Compose development and Kubernetes deployment. Integration tests are split by service and use WebApplicationFactory with in-memory databases and mocked external dependencies, which reinforces the service boundaries without requiring a full cluster to test behavior.
Main entry points: k8s Kubernetes · Glense.AccountService Account API · Glense.Server Gateway · Glense.VideoCatalogue Video catalogue
Components 20
Frontend
React/Vite browser app and its API-facing modules.
- Client app · Browser entrypoint and feature composition for end users.
glense.client/src - API layer · Shared API clients and auth/profile/video/chat wrappers.
glense.client/src/services
Edge Gateway
Public API routing and cross-cutting request boundary.
- Gateway · Single public edge that routes requests to backend services and hubs.
Glense.Server
Backend Services
Independent .NET services owning distinct business domains.
- Account API · Auth, profiles, notifications, and internal account lookups.
services/Glense.AccountService - Account gRPC · Username/profile lookup contract used by other services.
services/Glense.AccountService/GrpcServices/AccountGrpcService.cs - Video catalogue · Videos, uploads, comments, playlists, likes, and subscriptions.
services/Glense.VideoCatalogue - Video storage · Uploaded video persistence with local-file implementation in repo.
services/Glense.VideoCatalogue/Services/LocalFileVideoStorage.cs - Donation service · Wallets, deposits, withdrawals, and donation transfers.
Glense.Server/DonationService - Chat service · Chat rooms, messages, and real-time messaging endpoints.
services/Glense.ChatService - Chat hub · Real-time chat channel exposed alongside REST controllers.
services/Glense.ChatService/Hubs/ChatHub.cs
Datastores
Per-service persistence and shared infrastructure.
- RabbitMQ · Async event backbone connecting account, donation, and video workflows.
k8s/rabbitmq-deployment.yaml - Account DB · Dedicated PostgreSQL database for account and notification data.
services/Glense.AccountService/database/schema.sql - Video DB · Dedicated PostgreSQL database for catalogue data.
services/Glense.VideoCatalogue/Database/schema.sql - Donation DB · Dedicated PostgreSQL database for wallet and donation state.
Glense.Server/DonationService/Data/schema.sql - Chat DB · Dedicated PostgreSQL database for chat state.
services/Glense.ChatService/database/schema.sql - Kubernetes · Service, Postgres, and RabbitMQ deployment manifests.
k8s
Integration Tests
Service-level integration suites and shared test helpers.
- Account tests · HTTP and consumer integration coverage for the account service.
tests/AccountService.IntegrationTests - Video tests · Controller and storage-adjacent integration coverage for catalogue flows.
tests/VideoCatalogue.IntegrationTests - Donation tests · Controller, DB, and consumer integration coverage for donation flows.
tests/DonationService.IntegrationTests - Chat tests · Controller integration coverage for chat and message flows.
tests/ChatService.IntegrationTests
Connections 33
- Client app → API layer: uses · UI calls shared frontend API wrappers.
- API layer → Gateway: public API · Browser traffic goes through the gateway base URL.
- Gateway → Account API: auth/profile · Routes identity and profile traffic to account.
- Gateway → Video catalogue: video/search · Routes content browsing and playback traffic to catalogue.
- Gateway → Donation service: donations/wallets · Routes wallet and donation traffic to donation.
- Gateway → Chat service: chats/messages · Routes chat traffic to the chat service.
- Gateway → Chat hub: /hubs/chat · Exposes the real-time chat hub through the edge.
- Account API → Account gRPC: serves · Provides trusted profile lookup RPC.
- Account API → Account DB: persists · Owns identity and notification state.
- Account API → RabbitMQ: publishes/consumes · Handles registration, donation, and subscription events.
- Video catalogue → Video DB: persists · Owns catalogue and interaction state.
- Video catalogue → Video storage: stores media · Uploads are written through the storage abstraction.
- Video catalogue → Account gRPC: resolves users · Uses account lookup RPC for usernames/profile data.
- Video catalogue → RabbitMQ: publishes · Emits subscription-related events for notifications.
- Donation service → Account API: validates recipients · Uses trusted internal HTTP before transfers.
- Donation service → Donation DB: persists · Owns wallets and donation transactions.
- Donation service → RabbitMQ: publishes/consumes · Consumes registration and publishes donation events.
- Chat service → Chat DB: persists · Owns chats and message history.
- Account API → Chat service: notifies · Account notifications reflect chat-related activity indirectly via events.
- Kubernetes → Gateway: deploys · Kubernetes manifests deploy the edge gateway.
- Kubernetes → Account API: deploys · Kubernetes manifests deploy the account service.
- Kubernetes → Video catalogue: deploys · Kubernetes manifests deploy the video catalogue service.
- Kubernetes → Donation service: deploys · Kubernetes manifests deploy the donation service.
- Kubernetes → Chat service: deploys · Kubernetes manifests deploy the chat service.
- Kubernetes → RabbitMQ: deploys · Kubernetes manifests deploy the event bus.
- Kubernetes → Account DB: deploys · Kubernetes manifests deploy service-owned Postgres.
- Kubernetes → Video DB: deploys · Kubernetes manifests deploy service-owned Postgres.
- Kubernetes → Donation DB: deploys · Kubernetes manifests deploy service-owned Postgres.
- Kubernetes → Chat DB: deploys · Kubernetes manifests deploy service-owned Postgres.
- Account tests → Account API: covers · Service-specific integration suite.
- Video tests → Video catalogue: covers · Service-specific integration suite.
- Donation tests → Donation service: covers · Service-specific integration suite.
- Chat tests → Chat service: covers · Service-specific integration suite.