Competitive programming platforms like LeetCode exist, but building one from scratch teaches you things using them never will. That's why I built BrewAlgo — a full-stack online judge where you can solve DSA problems, submit code, and see it run in real time.
This is my personal project, built during my BTech CSE at Jamia Hamdard University.
BrewAlgo is an online coding judge. You browse problems, write code in the browser, submit it, and the platform runs it against test cases and tells you if you passed.
The two things I'm most proud of:
Secure code execution — your code runs inside an isolated Docker container with CPU, memory, and time limits. It never touches the host machine.
Clean Architecture — the backend is structured in four layers (Domain, Application, Infrastructure, Presentation) so the business logic stays completely independent of frameworks and databases.
- User registration and login with JWT authentication
- 100+ curated DSA problems across Easy, Medium, and Hard
- Code submission in Java and Python
- Real-time execution with detailed feedback (Accepted, Wrong Answer, TLE, Runtime Error, Compilation Error)
- Global leaderboard ranked by rating
- User profile with submission history and skill breakdown
- Rate limiting, audit logging, and request tracing
You'll need Java 17, Node.js 18, PostgreSQL 15, Docker Desktop, and Maven 3.9.
1. Clone the repo
git clone https://github.com/AshharAhmadKhan/BrewAlgo.git
cd BrewAlgo2. Create the database
psql -U postgres
CREATE DATABASE brewalgo;
\q3. Configure the backend
Open backend/src/main/resources/application.properties and update:
spring.datasource.password=your_postgres_password
jwt.secret=your_secret_key_here4. Build the Docker executor images
cd docker/java-executor
docker build -t brewalgo-java-executor:latest .
cd ../python-executor
docker build -t brewalgo-python-executor:latest .5. Start the backend
cd backend
mvn spring-boot:run6. Start the frontend
cd frontend
npm install
npm run devFrontend runs at http://localhost:5173, backend at http://localhost:8081.
When you submit code, here's what actually happens:
- The backend writes your code to a temporary file
- It creates a Docker container with strict limits — 256MB memory, 50% of one CPU core, 5 second timeout
- The container compiles and runs your code against each test case
- Output is captured and compared to the expected answer
- The container is destroyed and the temp files are deleted
- You get a verdict
The container has no network access and no access to the host filesystem. If your code tries to do something malicious, it just fails inside the container.
The obvious answer is security. But there's more to it.
Every submission gets a consistent environment regardless of what's installed on the server. The resource limits are enforced at the OS level, not by the application. And the architecture makes it easy to add new languages — you just write a new Dockerfile.
The tradeoff is speed. Creating a new container for each test case adds about 1-2 seconds of overhead. That's a known limitation and something I'd fix with container pooling if I continued developing this.
Backend — Spring Boot 3.2.1, Java 17, Spring Security with JWT, PostgreSQL, Spring Data JPA, Docker Java SDK
Frontend — React 18, Vite, Tailwind CSS, Monaco Editor, Axios
Infrastructure — Docker, Docker Compose, HikariCP connection pooling
BrewAlgo/
├── backend/
│ └── src/main/java/com/brewalgo/
│ ├── domain/ # Entities, repositories, exceptions
│ ├── application/ # Services, DTOs, business logic
│ ├── infrastructure/ # Security, persistence, config
│ └── presentation/ # Controllers
├── frontend/
│ └── src/
│ ├── components/ # Reusable UI components
│ ├── pages/ # Page components
│ ├── services/ # API layer
│ └── context/ # Auth and toast state
├── docker/
│ ├── java-executor/ # Java execution environment
│ └── python-executor/ # Python execution environment
└── docs/ # Architecture, API, setup guides
- Contest system (the backend is ready, the UI just shows "coming soon")
- WebSocket for real-time updates
- More languages (C++, JavaScript)
- Admin dashboard for managing problems
- Redis caching layer
- Container pooling for faster execution
- Architecture — system design, data flow, security layers
- API Reference — all endpoints with request/response examples
- Setup Guide — detailed setup with troubleshooting
Ashhar Ahmad Khan - [email protected]