Skip to content

Commit 31a03df

Browse files
authored
Create README.md
1 parent d6b2c21 commit 31a03df

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed

README.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# GOLANG Contest Portal Backend
2+
3+
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.
4+
A contest platform..
5+
---
6+
7+
## 🚀 Features
8+
9+
- **High Performance**: Built with Go for maximum efficiency and concurrent request handling.
10+
- **Scalable Architecture**: Microservices-based design with Docker containerization.
11+
- **Secure Authentication**: JWT-based authentication with role-based access control.
12+
- **Database Optimization**: MongoDB aggregation pipelines for efficient data retrieval.
13+
- **CI/CD Pipeline**: Automated deployment using GitHub Actions.
14+
- **SSL/TLS Support**: Secure communication with Certbot integration.
15+
- **Load Balancing**: Nginx reverse proxy for better request distribution.
16+
17+
---
18+
19+
## 🏗 Architecture
20+
21+
### Technology Stack
22+
- **Backend**: Go 1.23
23+
- **Database**: MongoDB
24+
- **Containerization**: Docker & Docker Compose
25+
- **Web Server**: Nginx
26+
- **SSL**: Certbot
27+
- **CI/CD**: GitHub Actions
28+
29+
---
30+
31+
## 🔒 Authentication & Authorization
32+
33+
- **JWT-based authentication** for secure user sessions.
34+
- **Role-based access control** for user and admin privileges.
35+
- **Secure cookie management**.
36+
- Protected routes with middleware.
37+
38+
---
39+
40+
## 📡 API Endpoints
41+
42+
### **Authentication**
43+
- `POST /api/signup` - Register a new user.
44+
- `POST /api/login` - User login.
45+
46+
### **Contests**
47+
- `POST /api/contest` - Create a new contest.
48+
- `GET /api/contest` - Retrieve all contests.
49+
- `GET /api/contest/{id}` - Retrieve contest details by ID.
50+
- `PUT /api/contest/{id}` - Update contest information.
51+
- `DELETE /api/contest/{id}` - Delete a contest.
52+
53+
### **Questions**
54+
- `POST /api/question` - Create a new question.
55+
- `GET /api/question/{id}` - Retrieve question details by ID.
56+
- `PUT /api/question/{id}` - Update question details.
57+
- `POST /api/contest/{id}/question` - Add a question to a contest.
58+
- `DELETE /api/contest/{contestId}/question/{questionId}` - Remove a question from a contest.
59+
60+
### **Test Cases**
61+
- `POST /api/testcase` - Create a new test case.
62+
- `PUT /api/testcase/{id}` - Update an existing test case.
63+
- `POST /api/question/{id}/testcase` - Add a test case to a question.
64+
- `DELETE /api/question/{questionId}/testcase/{testCaseId}` - Remove a test case from a question.
65+
66+
---
67+
68+
## 🚀 Getting Started
69+
70+
### Prerequisites
71+
- Docker and Docker Compose
72+
- Go 1.23+ (for local development)
73+
- MongoDB (for local development)
74+
75+
### Running Locally
76+
77+
1. Clone the repository:
78+
```bash
79+
git clone https://github.com/krishkumar84/bdcoe-golang-portal.git
80+
cd bdcoe-golang-portal
81+
cp config/example.yaml config/local.yaml
82+
docker-compose up -d
83+
2. Config.yaml:
84+
```bash
85+
env: "development"
86+
DatabaseURL: "mongodb://localhost:27017"
87+
DatabaseName: "bdcoe_portal"
88+
JwtSecret: "your-secret-key"
89+
```
90+
91+
💪 Performance & Scalability
92+
93+
### MongoDB Optimization
94+
- Efficient aggregation pipelines for complex queries.
95+
- Indexed collections for faster lookups.
96+
- Proper document structure for optimal data retrieval.
97+
98+
### Go Performance Features
99+
- Goroutines for concurrent request handling.
100+
- Efficient connection pooling.
101+
- Context-based timeout management.
102+
- Structured logging with `slog`.
103+
104+
### Docker & Infrastructure
105+
- Multi-stage builds for smaller and efficient images.
106+
- Container orchestration with Docker Compose.
107+
- Nginx load balancing for optimized request distribution.
108+
- Automated SSL certificate renewal with Certbot.
109+
110+
## 🔐 Security Features
111+
- JWT token-based authentication.
112+
- Password hashing for secure credentials.
113+
- HTTPS enforcement with SSL/TLS.
114+
- Secure cookie configuration.
115+
- Role-based access control.
116+
- Request validation and input sanitization.
117+
118+
## 📦 Deployment
119+
This project uses **GitHub Actions** for CI/CD. Automated deployment targets an EC2 instance with Docker-based container orchestration.
120+
121+
## 📝 Contributing
122+
1. Fork the repository.
123+
2. Create a feature branch:
124+
```bash
125+
git checkout -b feature/AmazingFeature
126+
```
127+
3. Commit your changes:
128+
```bash
129+
git commit -m "Add some AmazingFeature"
130+
```
131+
4. Push to the branch:
132+
```bash
133+
git push origin feature/AmazingFeature
134+
```
135+
5. Open a Pull Request.
136+
137+
## 📄 License
138+
This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for more details.
139+
140+
141+
142+
http_server:
143+
address: ":8000"
144+

0 commit comments

Comments
 (0)