βββββββ βββββββ βββββββ βββββββββββββββ ββββββββββββ βββ ββββββ ββββββββ ββββββββββββββββββββββββββββββββββββββββββββββ βββββββββββ βββ βββ ββββββ βββββββββ ββββββββββββββ ββββββ βββββββββββ βββ βββ ββββββ βββββββββ ββββββββββββββ ββββββββββββββββββ ββββββββ ββββββββββββββββββββββββββββ ββββββββββββββ βββββββββ βββ βββββββ βββββββ βββββββ βββββββββββ ββββββββββββββ ββββββββ βββ
Video Overview of the Platform: Coming Soon...
- ποΈ Overview
- β¨ Why CodeArena?
- β‘ Capabilities
- π§ Technical Deep Dive
- π οΈ Technology Stack
- π Quick Start
- βοΈ How It Works
- π» Development
- π¦ Deployment
- π‘ API
- π Security
- π Monitoring
- π₯ Team
- π€ Contributing
CodeArena separates concerns across stateless API servers, background workers, and real-time socket clusters β all coordinated through Redis.
flowchart TB
Client[Next.js Client] -->|HTTP| API[Next.js API Routes]
Client -->|WebSocket| Socket[Socket.IO Server]
API -->|Enqueue| Redis[(Redis)]
Socket -->|Pub/Sub| Redis
Redis -->|Process| Workers[BullMQ Workers]
Workers -->|Execute| Docker[Docker Sandbox]
Workers -->|Fallback| Judge0[Judge0 API]
Workers -->|Analyze| Groq[Groq AI]
API -->|Query| MongoDB[(MongoDB)]
Workers -->|Read/Write| MongoDB
style Docker fill:#2496ED,stroke:#fff,stroke-width:2px
style Redis fill:#DC382D,stroke:#fff,stroke-width:2px
style MongoDB fill:#47A248,stroke:#fff,stroke-width:2px
The design prioritizes security (sandboxed execution), scalability (horizontal socket scaling via Redis adapter), and resilience (graceful fallbacks when Docker is unavailable).
Most platforms in the competitive programming ecosystem specialize in only one part of the workflow β coding challenges, contests, interview preparation, or AI feedback.
CodeArena was built to explore how these systems could coexist within a unified architecture while maintaining secure execution, scalable real-time infrastructure, and low-latency developer interactions.
| Feature | Description |
|---|---|
| Competitive Programming | Multi-language judge (JS, Python, Java, C/C++, Go) with Docker sandboxing. Verdicts: ACCEPTED β’ WRONG_ANSWER β’ TLE β’ MLE β’ RUNTIME_ERROR β’ COMPILATION_ERROR |
| AI Interviews (Alex) | 4-phase mock interviews with streaming AI feedback via Socket.IO. Evaluates algorithms, code quality, and communication |
| Contests | Real-time ICPC-style leaderboards with plagiarism detection |
| Community | Developer feed, solution sharing, tag-based recommendations |
Dual-mode architecture:
-
Docker Sandbox (primary): Seccomp-filtered containers, no network, read-only rootfs, cgroup limits. Handles compiled (C++, Java) and interpreted (Python, JS) languages.
-
Judge0 API (fallback): Cloud fallback for Railway, Render, and other environments without Docker socket access.
Security: Pattern-based code validation, execution timeouts, auto-removal.
Seven BullMQ workers with idempotency guards:
| Worker | Purpose |
|---|---|
submission.worker.js |
Code execution & verdicts |
ai.worker.js |
Post-submission analysis (Groq Llama 3.3 70B) |
interviewAI.worker.js |
Real-time AI streaming |
interviewExecution.worker.js |
Interview code validation |
interviewSummarize.worker.js |
Session summarization |
plagiarism.worker.js |
Similarity detection |
stats.worker.js |
Performance aggregation |
Socket.IO with Redis adapter enables horizontal scaling. Multiple server instances share state via Redis pub/sub. JWT tokens secure WebSocket connections; tiered rate limiting protects endpoints.
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React 19, TailwindCSS 4, shadcn/ui, Monaco Editor |
| Backend | Next.js API Routes, Socket.IO 4, BullMQ 5, JWT, Zod |
| Data | MongoDB 8 (Mongoose), Redis 7 |
| Execution | Docker 24 + seccomp, Judge0 fallback |
| AI | Groq SDK (Llama 3.3 70B) |
| Deploy | Docker Compose, Railway, Render |
Docker (recommended):
git clone https://github.com/yourusername/codearena.git
cd codearena
chmod +x setup.sh && ./setup.sh
# Or: docker-compose up -dEnvironment:
MONGODB_URI=mongodb://admin:password@localhost:27017/codearena?authSource=admin
REDIS_URL=redis://:password@localhost:6379
JWT_SECRET=your-secret-key-min-32-charactersLocal dev:
npm install && npm run docker:build
npm run dev
node scripts/worker-boot.js # Separate terminalCode Submission Flow
sequenceDiagram
Client->>API: POST /api/submissions
API->>Redis: Enqueue
API->>Client: Job ID
Worker->>Redis: Pick up
Worker->>MongoDB: Fetch tests
Worker->>Docker: Execute
Docker->>Worker: Verdict
Worker->>Redis: Publish
Worker->>MongoDB: Save
Real-time Updates
sequenceDiagram
Worker->>Redis: Publish score
Redis->>Socket: Broadcast
Socket->>Client: Push
Scripts
| Command | Purpose |
|---|---|
npm run dev |
Dev server |
npm run docker:build |
Build executors |
node scripts/worker-boot.js |
Start workers |
node scripts/dev-all.js |
Concurrent mode |
Project Structure
src/
βββ app/ # Next.js App Router
βββ features/ # Problem-solve, interview, contests
βββ services/ # BullMQ workers
βββ lib/ # Docker, AI, Socket.IO
βββ models/ # Mongoose schemas
βββ socket/ # Namespaces
| Platform | Command |
|---|---|
| Railway | railway login && railway link && railway up |
| Render | Use render.yaml blueprint |
| Docker | docker build -t codearena . && docker run -p 3000:3000 -e MONGODB_URI=... codearena |
REST: Auth, Problems, Submissions, Contests, Interview, Feed, Admin
WebSocket: submission_update, contest_update, notification, interview_ai_stream
Health: GET /api/health
| Layer | Measures |
|---|---|
| Sandbox | Seccomp, no network, read-only rootfs, resource limits, pattern detection |
| API | Tiered rate limiting, JWT (httpOnly + Bearer), CORS, Zod validation |
| Data | bcryptjs, strong secrets, MongoDB authSource, Redis password auth |
Structured logging (auth, database, contest, system), query performance, cache hit rates, worker metrics. Health: GET /api/health
| Role | Member |
|---|---|
| ποΈ Architecture / Backend | Arafat Salehin |
| βοΈ Core Systems | AH Muzahid |
| π¨ UI / UX | Shahnawas Adeel |
| π» Frontend / Dashboard | Rabiul Islam |
| π» Frontend | Abdullah Noman |
| βοΈ Content | Ummey Salma Tamanna |
Fork β branch (feature/name) β commit β PR. Standards: ESLint, Prettier, Husky.
Built with Next.js, React, MongoDB, Redis, Docker, BullMQ, Socket.IO, Groq





