Skip to main content

Backend Architecture

Single ASP.NET Core (.NET 8) API that serves both the social Frontend and the Admin Panel, plus separate worker processes.

Bellamy Book is a self-hosted social network: one API deployment per community instance.

Technology stack​

LayerChoice
Runtime.NET 8 / C#
APIASP.NET Core, JWT, FluentValidation, Prometheus
PatternsClean Architecture, MediatR (CQRS-style), DDD modules
SQLEF Core 8 + PostgreSQL (primary + readonly)
DocumentMongoDB (comments, chat, notifications, push tokens)
CacheRedis
EventsKafka (social / analytics / search sync)
QueuesRabbitMQ (chat, notifications, push, moderation, AI blog)
GraphNeo4j
SearchElasticsearch
StorageMinIO or Cloudflare R2
MediaImageSharp, FFmpeg
JobsQuartz.NET (API + BlogAutoGenerationWorker)
CallsLiveKit
SignalR hosting

Chat and notification hubs run on ChatWorker and WebSocketWorker, not inside the API process.

Solution layout (Src/backend/)​

ProjectRole
APIREST controllers, middleware, Quartz host
ApplicationMediatR commands/queries/handlers
DomainAggregates, domain events
InfrastructureEF, Mongo, Kafka, RabbitMQ, Neo4j, ES, MinIO/R2
SharedDTOs, messaging contracts, constants
SharedWorkerWorker base + Kafka helpers
DatabaseApplicationMigrations / seeding
Workers (13)See Workers

Dependency direction: API → Application → Domain; Infrastructure implements Application contracts.

Controllers (domains)​

Auth, User, Post, Story, Comment, Blog, Media, Chat, Call, Friendship, Follow, Notification, Announcement, Search, Sitemap, Admin (dashboard, backup, content-alerts, elasticsearch, search-analytics), License, AiAgent, Tickets, EmailCampaign, ApplicationSettings, Moderation, Push subscriptions, Health, …

Many features use Read/Write controller splits and MediatR handlers under Application/Modules/.

Middleware (typical order)​

Error handling → security headers → CORS → host validation → rate limiting → authentication/authorization → license enforcement → controllers → metrics.

Buses​

BusUsed forConsumers
Kafkauser_interacted, content_created/updated/deleted, …Interaction, Scoring, Trending, Graph, Hashtag, ES Sync
RabbitMQChat, friendship, notifications, push, moderation, blog generationChatWorker, WebSocketWorker, Web/Expo push, ContentModeration, BlogAutoGen
PollingPending MediaFile rowsMediaProcessingWorker