TheSocial-Backend is the backend service for the Swamajik Madhyam ecosystem, built using CQRS (Command Query Responsibility Segregation) and DDD (Domain-Driven Design) principles.
This architecture ensures scalability, clean separation of concerns, and transparency in handling social interactions.
- βοΈ CQRS Pattern β Separate read and write models for efficiency and scalability.
- π§© DDD Modules β Core business logic structured into domains (Users, Posts, Moderation, Ads, etc.).
- π‘οΈ Content Moderation β Transparent pipelines with community + AI checks.
- π Authentication & Identity β Role-based access, optional decentralized identity support.
- π Open Analytics β Privacy-respecting insights, visible to the community.
- πͺ Transparent Ads β Auditable ad system with clear policies.
- Commands β Handle state-changing operations (create post, ban user, etc.).
- Events β Domain events that trigger reactions across services.
- Queries β Optimized read models for fast, scalable data access.
- Domain Layer β Business rules & aggregates.
- Application Layer β Use cases, orchestration of commands/queries.
- Infrastructure Layer β Database, message bus, external integrations.
- API Layer β GraphQL/REST interface for apps.
the-social-backend/
βββ apps/
β βββ api-gateway/ # API (GraphQL/REST) entrypoint
β
βββ modules/
β βββ users/ # User domain (auth, profiles, roles)
β βββ posts/ # Posts & feeds domain
β βββ moderation/ # Moderation domain
β βββ ads/ # Advertisement domain
β βββ analytics/ # Analytics & reporting domain
β
βββ libs/
β βββ shared-kernel/ # Shared types, events, utilities
β βββ infrastructure/ # DB, cache, message bus
β
βββ database/ # Migrations & schemas
βββ docker/ # Deployment configs
βββ README.md
- Node.js / NestJS (modular DDD framework)
- GraphQL + REST (API layer)
- PostgreSQL (write DB) + MongoDB/Elastic (read DB for queries)
- Redis / Kafka (event bus & async processing)
- Docker & Kubernetes (deployment)
- Fork this repository and clone it locally.
- Install dependencies with
npm installoryarn. - Start services using
docker-compose up. - Use
nx serve api-gatewayto run the API locally. - Submit issues or PRs to improve the backend.
Licensed under Open Source principles β transparent, auditable, and community-driven.