A high-performance, scalable online judge system built with Go, MongoDB, and Docker. This system supports programming contests, user authentication, problem management, and test case validation. A contest platform..
- High Performance: Built with Go for maximum efficiency and concurrent request handling.
- Scalable Architecture: Microservices-based design with Docker containerization.
- Secure Authentication: JWT-based authentication with role-based access control.
- Database Optimization: MongoDB aggregation pipelines for efficient data retrieval.
- CI/CD Pipeline: Automated deployment using GitHub Actions.
- SSL/TLS Support: Secure communication with Certbot integration.
- Load Balancing: Nginx reverse proxy for better request distribution.
- Backend: Go 1.23
- Database: MongoDB
- Containerization: Docker & Docker Compose
- Web Server: Nginx
- SSL: Certbot
- CI/CD: GitHub Actions
- JWT-based authentication for secure user sessions.
- Role-based access control for user and admin privileges.
- Secure cookie management.
- Protected routes with middleware.
POST /api/signup- Register a new user.POST /api/login- User login.
POST /api/contest- Create a new contest.GET /api/contest- Retrieve all contests.GET /api/contest/{id}- Retrieve contest details by ID.PUT /api/contest/{id}- Update contest information.DELETE /api/contest/{id}- Delete a contest.
POST /api/question- Create a new question.GET /api/question/{id}- Retrieve question details by ID.PUT /api/question/{id}- Update question details.POST /api/contest/{id}/question- Add a question to a contest.DELETE /api/contest/{contestId}/question/{questionId}- Remove a question from a contest.
POST /api/testcase- Create a new test case.PUT /api/testcase/{id}- Update an existing test case.POST /api/question/{id}/testcase- Add a test case to a question.DELETE /api/question/{questionId}/testcase/{testCaseId}- Remove a test case from a question.
- Docker and Docker Compose
- Go 1.23+ (for local development)
- MongoDB (for local development)
- Clone the repository:
git clone https://github.com/krishkumar84/bdcoe-golang-portal.git cd bdcoe-golang-portal cp config/example.yaml config/local.yaml docker-compose up -d - Config.yaml:
env: "development"
DatabaseURL: "mongodb://localhost:27017"
DatabaseName: "bdcoe_portal"
JwtSecret: "your-secret-key"💪 Performance & Scalability
- Efficient aggregation pipelines for complex queries.
- Indexed collections for faster lookups.
- Proper document structure for optimal data retrieval.
- Goroutines for concurrent request handling.
- Efficient connection pooling.
- Context-based timeout management.
- Structured logging with
slog.
- Multi-stage builds for smaller and efficient images.
- Container orchestration with Docker Compose.
- Nginx load balancing for optimized request distribution.
- Automated SSL certificate renewal with Certbot.
- JWT token-based authentication.
- Password hashing for secure credentials.
- HTTPS enforcement with SSL/TLS.
- Secure cookie configuration.
- Role-based access control.
- Request validation and input sanitization.
This project uses GitHub Actions for CI/CD. Automated deployment targets an EC2 instance with Docker-based container orchestration.
- Fork the repository.
- Create a feature branch:
git checkout -b feature/AmazingFeature
- Commit your changes:
git commit -m "Add some AmazingFeature" - Push to the branch:
git push origin feature/AmazingFeature
- Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for more details.
http_server: address: ":8000"