How waterrmalann/bit-warriors-backend works
Project type and purpose
• This is a service-oriented Node.js backend for BitWarriors, an AI-powered competitive coding platform (inspired by LeetCode/CodeWars).
• It’s composed of multiple discrete microservices (User, Problem, Submission, Test, Gateway, CES) communicating synchronously via an API Gateway and asynchronously via Apache Kafka.
• Each service follows a clean/hexagonal architecture: layers for Application (use-cases), Domain (entities, interfaces), Infrastructure (database, messaging, webserver), Interfaces (controllers, routes, consumers).
File structure
• Top-level services:
– gateway-dev (API gateway, JWT auth middleware, Express proxy)
– user-service (auth, profiles, OAuth, MFA, JWT, Kafka consumer/producer, MongoDB)
– problem-service (CRUD problems, voting, Kafka events, MongoDB)
– submission-service (submit/run problems, leaderboards, Kafka events, MongoDB)
– test-service (code evaluation via Judge0 or V8 sandbox, used internally by submission-service)
– ces-dev (Code Execution Sandbox container for safe execution of arbitrary code)
• infra/helm: Helm charts for each service, Kafka, MongoDB.
• Build workflows: GitHub Actions for each service.
Key insights from README
• API Gateway handles authentication (JWT) and proxies to downstream services.
• Kafka is the asynchronous message broker connecting services (e.g., Problem → Submission, Submission → User for stats, etc.).
• Each service has its own MongoDB schema (statefulset) and secrets.
• Containerized with Docker, orchestrated via Kubernetes (Helm charts).