PDP School Coding League - Competition Tracker & Leaderboard A comprehensive full-stack application for managing coding competitions, tracking team performance, and displaying leaderboards. Features
🔐 JWT Authentication & Authorization 👥 Team Management 🏆 Competition Tracking 📅 Event Scheduling 📊 Real-time Leaderboard 📱 Responsive Design 🔍 Swagger UI API Documentation
Tech Stack Backend
Framework: Spring Boot 3.2.0 Build Tool: Gradle 8.5 Database: PostgreSQL 15 Security: Spring Security + JWT API Documentation: SpringDoc OpenAPI (Swagger UI) ORM: Spring Data JPA Validation: Jakarta Validation Mapping: MapStruct
Frontend
Framework: Next.js 14 (React 18) Language: TypeScript Styling: TailwindCSS State Management: React Hooks HTTP Client: Axios
DevOps
Containerization: Docker & Docker Compose Database: PostgreSQL in Docker
Project Structure pdp-coding-league/ ├── backend/ │ ├── src/ │ │ ├── main/ │ │ │ ├── java/uz/pdp/codingleague/ │ │ │ │ ├── config/ # Configuration classes │ │ │ │ ├── controller/ # REST Controllers │ │ │ │ ├── dto/ # Data Transfer Objects │ │ │ │ ├── entity/ # JPA Entities │ │ │ │ ├── exception/ # Exception handlers │ │ │ │ ├── mapper/ # MapStruct mappers │ │ │ │ ├── repository/ # JPA Repositories │ │ │ │ ├── security/ # Security components │ │ │ │ └── service/ # Business logic │ │ │ └── resources/ │ │ │ └── application.properties │ │ └── test/ │ ├── build.gradle │ ├── settings.gradle │ └── Dockerfile ├── frontend/ │ ├── src/ │ │ ├── app/ │ │ ├── components/ │ │ └── lib/ │ ├── package.json │ └── Dockerfile └── docker-compose.yml Getting Started Prerequisites
Docker & Docker Compose Java 17+ (for local development) Node.js 18+ (for local development) PostgreSQL 15+ (for local development)
Running with Docker
Clone the repository
bashgit clone cd pdp-coding-league
Start all services
bashdocker-compose up -d This will start:
PostgreSQL on port 5432 Backend API on port 8080 Frontend on port 3000
Access the applications
Frontend: http://localhost:3000 Backend API: http://localhost:8080 Swagger UI: http://localhost:8080/swagger-ui.html API Docs: http://localhost:8080/api-docs
Running Locally Backend bashcd backend ./gradlew bootRun Frontend bashcd frontend npm install npm run dev API Endpoints Authentication
POST /api/auth/register - Register new user POST /api/auth/login - Login user
Teams
GET /api/teams - Get all teams (ordered by rank) GET /api/teams/{name} - Get team by name POST /api/teams - Create team (Admin only) PUT /api/teams/{name} - Update team (Admin only) DELETE /api/teams/{name} - Delete team (Admin only)
Competitions
GET /api/competitions - Get all competitions GET /api/competitions/{id} - Get competition by ID GET /api/competitions/status/{status} - Get by status POST /api/competitions - Create competition (Admin only) PUT /api/competitions/{id} - Update competition (Admin only) DELETE /api/competitions/{id} - Delete competition (Admin only)
Schedule
GET /api/schedule - Get all schedules GET /api/schedule/{id} - Get schedule by ID GET /api/schedule/status/{status} - Get by status POST /api/schedule - Create schedule (Admin only) PUT /api/schedule/{id} - Update schedule (Admin only) DELETE /api/schedule/{id} - Delete schedule (Admin only)
Competition Results
GET /api/results - Get all competition results GET /api/results/{id} - Get result by ID GET /api/results/competition/{competitionId} - Get results by competition GET /api/results/team/{teamId} - Get results by team POST /api/results - Create competition result (Admin only) PUT /api/results/{id} - Update result (Admin only) DELETE /api/results/{id} - Delete result (Admin only)
Authentication The API uses JWT tokens for authentication. Include the token in the Authorization header: Authorization: Bearer Default Admin Account For testing purposes, you should create an admin account through the register endpoint and manually set the role to ADMIN in the database. Environment Variables Backend propertiesSPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/pdp_coding_league SPRING_DATASOURCE_USERNAME=pdp_user SPRING_DATASOURCE_PASSWORD=pdp_password JWT_SECRET=your-secret-key-change-in-production JWT_EXPIRATION=86400000 Frontend envNEXT_PUBLIC_API_URL=http://localhost:8080/api Database Schema Users
id, username, email, password, full_name, role, enabled, created_at, updated_at
Teams
id, name, points, wins, competitions, rank_change, description, created_at, updated_at team_members (collection table)
Competitions
id, name, location, date, points, status, description, created_at, updated_at competition_teams (collection table)
Schedule
id, name, date, location, status, description, created_at, updated_at schedule_participants (collection table)
Competition Results
id, competition_id, team_id, rank, points_earned, notes
Security Features
Password encryption using BCrypt JWT-based authentication Role-based access control (USER, ADMIN) CORS configuration API endpoint protection
API Documentation Access the interactive API documentation at:
Swagger UI: http://localhost:8080/swagger-ui.html
The Swagger UI provides:
Complete API reference Request/response schemas Try-it-out functionality Authentication support
Development Backend Development bash# Run tests ./gradlew test
./gradlew build
./gradlew clean build Frontend Development bash# Install dependencies npm install
npm run dev
npm run build
npm start Deployment Backend Deployment
Deploy to Render, Railway, or any cloud platform supporting Docker Set environment variables in the platform Ensure PostgreSQL is accessible
Frontend Deployment
Deploy to Vercel, Netlify, or similar platforms Set NEXT_PUBLIC_API_URL to your backend URL
Contributing
Fork the repository Create your feature branch (git checkout -b feature/amazing-feature) Commit your changes (git commit -m 'Add some amazing feature') Push to the branch (git push origin feature/amazing-feature) Open a Pull Request
License This project is licensed under the MIT License. Support For support, email [email protected] or visit https://pdp.uz Authors
PDP School Development Team