A web-based competitive programming platform built entirely in C++ (backend) with a custom HTML/CSS/JS frontend. No external frameworks or libraries used on the server side — everything from HTTP parsing to JSON building to the Virtual File System is hand-written.
Course: Object Oriented Programming (Spring 2026)
University: FAST-NUCES
- User Registration & Login — with email verification (simulated), session management via cookies
- 50 Practice Problems — across 5 difficulty levels (Easy → Hard), each with multiple test cases
- Timed Contests — Easy (3 problems/60min), Medium (4/90min), Hard (5/120min)
- Code Evaluation Engine — compiles and runs user C++ code against test cases
- 5 Verdicts — AC (Accepted), WA (Wrong Answer), CE (Compile Error), RE (Runtime Error), TLE (Time Limit Exceeded)
- Solution Persistence — all code saved to Virtual File System
- Contest History & Scoring — time-based scoring with wrong attempt penalties
- Custom HTTP Server — single-threaded server (Winsock2 on Windows, POSIX sockets on Linux/macOS) with full request/response parsing
- Virtual File System (VFS) — hierarchical file system with volumes, partitions, directories, files, permissions, and users
- Process Isolation — compiles and runs user code in a child process with I/O redirection and 5-second timeout (TLE detection). Uses
CreateProcesson Windows,fork()/exec()on Linux/macOS - No STL Containers — custom implementations: MyString, StringMap (hash map), IntArray, BoolArray, StringPtrArray, ProblemPtrArray, UserMap
- JSON Parser & Builder — hand-written JSON parsing (HttpRequest) and serialization (JsonBuilder)
- Session-based Auth — random token generation, cookie-based sessions stored in VFS
- Inheritance —
ISerializableinterface,FileSystemEntity→File/Directory,StorageMediumhierarchy - Polymorphism — virtual functions in VFS entities, serializable interface
- Encapsulation — private members with public getters/setters throughout
- Composition —
VolumecontainsStorageMediumcontainsPartitioncontainsDirectory/File - Operator Overloading —
MyStringassignment operator, copy constructors - Abstract Classes —
ISerializablewith pure virtualserialize()/deserialize()
├── main.cpp # Entry point, wires everything together
├── CMakeLists.txt # Build configuration
├── vfs/ # Virtual File System (core OOP showcase)
│ ├── Volume.h/cpp # Top-level container
│ ├── StorageMedium.h/cpp # Disk abstraction
│ ├── Partition.h/cpp # Partition with filesystem type
│ ├── Directory.h/cpp # Directory node
│ ├── File.h/cpp # File node with content
│ ├── Permission.h/cpp # rwx permission model
│ └── User.h/cpp # VFS user (not app user)
├── domain/ # Data models
│ ├── Problem.h/cpp # Problem with test cases
│ ├── TestCase.h/cpp # Input/expected output pair
│ └── Submission.h/cpp # Code + verdict + details
├── logic/ # Business logic
│ ├── EvaluationEngine.h/cpp # Compile + run + judge
│ ├── UserManager.h/cpp # Registration, login, sessions
│ ├── ProblemBank.h/cpp # 50 seeded problems
│ ├── ContestManager.h/cpp # Contest lifecycle + scoring
│ └── PersistenceManager.h/cpp # VFS read/write helper
├── server/ # HTTP layer
│ ├── HttpServer.h/cpp # Winsock2 accept loop
│ ├── HttpRequest.h/cpp # Parse method/path/headers/body/JSON
│ ├── HttpResponse.h/cpp # Status codes, headers, file serving
│ ├── Router.h/cpp # URL routing + static files
│ ├── ApiHandlers.h/cpp # All REST endpoints
│ └── JsonBuilder.h/cpp # JSON response construction
├── ds/ # Custom data structures
│ ├── MyString.h # Dynamic string (no std::string)
│ ├── StringMap.h # Hash map (string → string*)
│ ├── IntArray.h # Dynamic int array
│ ├── BoolArray.h # Dynamic bool array
│ ├── StringPtrArray.h # Dynamic MyString* array
│ └── ProblemPtrArray.h # Dynamic Problem* array
├── interfaces/
│ └── ISerializable.h # Pure virtual serialize/deserialize
└── frontend/ # Web UI
├── index.html # Redirects to login
├── login.html # Dual-panel sliding auth
├── verify.html # Email verification
├── dashboard.html # Contest start + history
├── problems.html # Problem browser with filters
├── editor.html # Code editor + submission
├── post-contest.html # Contest results
├── solutions.html # Saved solutions viewer
├── style.css # Global theme (dark hacker terminal)
├── app.js # Shared utilities (fetch, auth, toast)
├── editor.js # Code editor with syntax highlighting
└── timer.js # Contest countdown timer
- Any OS: Windows 10/11, Linux (Ubuntu/Fedora/Arch/etc.), or macOS
- C++17 compiler:
g++(6.3+) orclang++— must be on system PATH (g++ --versionshould work in terminal) - CMake (3.15+) — only needed for the CMake build path
Windows (MinGW):
mingw32-makeLinux / macOS:
makeProduces judge.exe (Windows) or judge (Linux/macOS) in project root.
Windows (MinGW):
mkdir build && cd build
cmake .. -G "MinGW Makefiles"
cmake --build . --target judgeLinux / macOS:
mkdir -p build && cd build
cmake ..
cmake --build . --target judgeProduces the judge binary in build/.
./judge # Linux/macOS
./judge.exe # WindowsServer starts on http://localhost:8080. Opens browser automatically.
- VFS is created fresh with 50 seeded problems
- Register an account, verify with displayed code, login
- Start practicing or enter a contest
| Method | Path | Description |
|---|---|---|
| POST | /api/auth/register | Create account |
| POST | /api/auth/verify | Verify email token |
| POST | /api/auth/login | Login (sets cookie) |
| POST | /api/auth/logout | Logout |
| GET | /api/user/profile | Current user info |
| GET | /api/problems | List all problems |
| GET | /api/problems/:id | Problem details |
| POST | /api/practice/submit | Submit practice solution |
| POST | /api/contest/start | Start timed contest |
| GET | /api/contest/status | Active contest info |
| GET | /api/contest/problems | Contest problem set |
| POST | /api/contest/submit | Submit contest solution |
| POST | /api/contest/save | Save code draft |
| POST | /api/contest/end | End contest early |
| GET | /api/contest/history | Past contest results |
| GET | /api/solutions | User's saved solutions |
- Base score per problem:
difficulty * 50 - Time bonus: decreases as more time passes
- Wrong attempt penalty: -10 per failed submission
- Final score: sum of all problem scores in contest
- Directory traversal prevention (
..in paths rejected) - No path reflection in error responses (XSS prevention)
- Password stored as-is (educational project, not production)
- Session tokens: 6-digit random
- 5-second execution timeout prevents infinite loops
- Process isolation:
CREATE_NO_WINDOWon Windows,fork()/exec()on Linux/macOS
- Single-threaded server (one request at a time)
- No HTTPS
- No persistent sessions across server restarts (VFS saves but sessions are in-memory)
| Problem | Solution |
|---|---|
g++ not found or compiler check fails at startup |
Ensure g++ or clang++ is on your system PATH. Run g++ --version in terminal to verify. On macOS, install Xcode Command Line Tools: xcode-select --install. |
Port 8080 already in use / bind fails |
Another process is using port 8080. Close it or wait a moment after previous server shutdown. Windows: netstat -ano | findstr 8080. Linux/macOS: lsof -i :8080. |
| Browser doesn't open automatically | Manually navigate to http://localhost:8080. Auto-open uses ShellExecuteA (Windows), xdg-open (Linux), or open (macOS). |
| Server exits immediately with no output | Check that data/ directory is writable. Try running from the project root directory (where main.cpp lives). |
| Existing accounts don't work after rebuild | Delete data/volume.vfs to reset — password hashing may have changed between builds. |