The Problems Service is a microservice in our coding platform responsible for managing programming problems and handling user submissions.
It provides:
- Admin features to create, update, and delete coding problems
- User features to browse problems with filters and pagination
- Secure code execution in Docker containers with automated testing
- Asynchronous job handling with RabbitMQ workers
This service powers the problem-solving core of the platform.
- 📝 Problem Management – Create, update, delete, and retrieve problems
- 🔍 Filtering & Search – Difficulty, tags, categories, and pagination
- ⚡ Code Submissions – Users can submit solutions for automated testing
- 🐇 Asynchronous Execution – RabbitMQ workers for scalable processing
- 🔒 Authentication & Roles – Admin vs. user permissions via JWT
- 🗄 Database – PostgreSQL + Prisma ORM for persistence
- 🐳 Docker Execution – Isolated sandbox environment for secure code execution
- Backend: Node.js, TypeScript, Express
- Database: PostgreSQL, Prisma ORM
- Messaging : RabbitMQ
- Execution: Docker (secure sandbox)
- Testing: Jest, Supertest, Testcontainers Postman
- Node.js (v18+)
- Docker
- PostgreSQL
- RabbitMQ
- pnpm package manager
note:- You can use docker-compose for external services (PostgreSQL, RabbitMQ, Redis).
-
Clone the repository
git clone https://github.com/mdarkanurl/DeshCode.git
-
And navigate to
app/problemscd app/problems -
Install necessary dependency
pnpm install --frozen-lockfile
-
Add environment variable create a
.envfile and add the variable. Use.env.examplefor guidance. -
Setup database
pnpm prisma:generate npx prisma migrate deploy
-
Run the app
pnpm dev # development pnpm build && pnpm start # production
POST /api/v1/problems # Create problem (Admin only)
GET /api/v1/problems # Get all problems (filters: difficulty, category, tags, pagination)
GET /api/v1/problems/:id # Get specific problem
PUT /api/v1/problems/:id # Update problem (Admin only)
DELETE /api/v1/problems/:id # Delete problem (Admin only)POST /api/v1/submissions # Submit solution (Authenticated users)
GET /api/v1/submissions/:id # Get submission statusGET /api/health # Service health check
GET / # Service infoThis service has full integration tests using Jest, Supertest, and Testcontainers.
note:- Auth service must be up and running in order to test Problems service.
pnpm test- ✅ Application tests (health, root, DB)
- ✅ Problem management (CRUD, filters, validation, auth)
- ✅ Submissions (workflow, status tracking, error handling)
- ✅ Worker system (RabbitMQ + Docker execution)
- ✅ Error scenarios (invalid inputs, unsupported languages)
- Start containers (Postgres, RabbitMQ, workers)
- Login as admin/user
- Create test problems
- Submit solutions
- Verify status/results
- Cleanup
The Problems Service follows a microservice architecture with clear separation of concerns:
- API Layer – Express routes with authentication & authorization middleware
- Business Layer – Services handle problem management & submissions
- Data Layer – PostgreSQL + Prisma ORM for persistence
- Messaging Layer – RabbitMQ for asynchronous job processing
- Worker System – Dedicated workers execute user code inside Docker containers
- Security – JWT authentication, role-based access, resource isolation for execution
- Scalability – Queue-based execution allows horizontal scaling of workers
Contributions, issues, and feature requests are welcome! If you want to contribute to DeshCode, please follow the guidelines outlined in the contributing.md file.
MIT License