Microservices Architecture
Overview of the architecture in Bellamy Book: a single Backend API (ASP.NET Core) with controller-based modules, plus background workers that consume Kafka events. For a step-by-step walkthrough of the overall architecture, see Understanding the Architecture.
Service Decomposition
Backend API (monolith)
Single .NET API with controller-based routing. Main areas:
- Authentication (
api/Authentication) – login, register, refresh, me, user profile, 2FA, impersonation - Post (
api/Post) – feed, create, get, update, delete, reactions, statistics - Comment (
api/Comment) – create, reply, get, delete, comment reactions - Story (
api/Story) – create, feed, view, react, archive - Friendship / Follow / friends (
api/Friendship,api/Follow,api/friends) – friends, requests, suggestions, block - Chat / Call / StrangerChat (
api/Chat,api/Call,api/StrangerChat) – messages, conversations, groups, calls - Notification (
api/Notification) – paged, unread count, mark read - Hashtags (
api/Hashtags) – search, details, posts, trending, recommended - Search (
api/Search) – full-text search (Elasticsearch) - Blog (
api/Blog,api/blog-comments) – blogs, blog comments - Admin (
api/admin/dashboard,api/admin/backup,api/admin/elasticsearch, etc.) – dashboard, backup, Elasticsearch, analytics - License, AiAgent, ApplicationSettings, Ticket, Media, SEO – license, AI agent, settings, tickets, media, sitemap
Background Workers (Kafka consumers)
Workers run as separate processes and consume Kafka topics:
- GraphWorker – social graph (Neo4j), friend suggestions
- ScoringWorker – content scores, recommendation
- TrendingWorker – trending decay
- InteractionWorker – engagement processing
- HashtagWorker – hashtag extraction/indexing
- ElasticsearchSyncWorker – sync content to Elasticsearch
- BlogAutoGenerationWorker – AI blog generation
- MediaProcessingWorker – media processing
- WebSocketWorker – real-time notifications (SignalR)
- WebPushNotificationWorker – push notifications
- ChatWorker – real-time chat (SignalR hub), online users, offline messages
Frontend & Admin
- Frontend (React + Vite) – social app (feed, profile, messaging, blogs, hashtags, etc.)
- Admin (React + CoreUI) – dashboard, users, content/blogs, notifications, backup, settings, license, AI agent
Service Communication
Synchronous
- REST between frontend/admin and Backend API
- SignalR for real-time (notifications, chat)
Asynchronous
- API publishes domain events to Kafka
- Workers consume Kafka topics and update PostgreSQL, MongoDB, Redis, Neo4j, Elasticsearch
Data Management
- PostgreSQL – users, posts, comments, reactions, friendships, follows, hashtags, blogs, tickets, etc.
- MongoDB – stories, chat messages, notifications (and related documents)
- Redis – cache, sessions, rate limiting, real-time state
- Neo4j – social graph, recommendations
- Elasticsearch/OpenSearch – full-text search (posts, blogs)
Deployment
- API – containerized (Docker)
- Workers – one deployment per worker type, scalable
- Frontend / Admin – static build served by Nginx or CDN