A complete, production-ready tournament management system supporting Round Robin, Single Elimination, and Double Elimination formats for both singles and doubles matches.
- Features
- Tech Stack
- Quick Start
- Manual Installation
- API Documentation
- Configuration
- Docker Deployment
- Production Deployment
- Project Structure
- Contributing
- License
-
Multiple Format Support:
- Round Robin (every player/team plays every other player/team)
- Single Elimination (knockout brackets)
- Double Elimination (winners and losers brackets with bronze match)
-
Singles & Doubles: Full support for both individual and team-based competitions
-
Flexible Match Configuration: Customize games per match, scoring systems
-
Automated Seeding: Manual or automatic seeding based on rankings
-
Live Standings: Real-time leaderboards and rankings
- Secure Authentication: JWT-based auth with password reset via email
- User Profiles: Track player statistics and tournament history
- Team Management: Create and manage doubles teams
- Event Registration: Players can register for events with approval workflows
- Tournament Control: Create, edit, and manage tournaments
- Event Scheduling: Set up multiple events per tournament
- Match Management: Record scores, update results
- Access Control: Tournament owners and authorized editors
- League System: Track player rankings across multiple tournaments
- REST API: Comprehensive API with Swagger/OpenAPI documentation
- Database Migrations: Automated schema versioning with Flyway
- Containerization: Docker and Docker Compose support
- Error Monitoring: Structured logging with integration points for Sentry
- Security: Rate limiting, CORS protection, input validation
- Production Ready: Connection pooling, health checks, graceful shutdown
- Framework: Spring Boot 3.5.3
- Language: Java 21
- Database: PostgreSQL 17
- Security: Spring Security + JWT
- ORM: Hibernate/JPA
- Migrations: Flyway
- Documentation: SpringDoc OpenAPI 3
- Build Tool: Maven
- Framework: React 18
- Build Tool: Vite
- HTTP Client: Axios
- Routing: React Router
- Styling: CSS Modules
- Containerization: Docker & Docker Compose
- Web Server: Nginx (for frontend)
- Logging: Logback with rolling file appenders
The fastest way to get Tournament Host running:
- Docker (v20.10+)
- Docker Compose (v2.0+)
-
Clone the repository
git clone https://github.com/yourusername/tournament-host.git cd tournament-host -
Set up environment variables
cp .env.example .env
-
Edit
.envand configure:# REQUIRED: Change these values! DB_PASSWORD=your_secure_password_here JWT_SECRET_KEY=$(openssl rand -base64 64) SENDGRID_API_KEY=your_sendgrid_api_key
-
Start all services
docker-compose up -d
-
Access the application
- Frontend: http://localhost:80
- Backend API: http://localhost:8080
- API Docs: http://localhost:8080/swagger-ui.html
That's it! The application is now running with:
- PostgreSQL database on port 5432
- Backend API on port 8080
- Frontend on port 80
docker-compose downdocker-compose logs -fIf you prefer to run without Docker:
- Java 21 or higher (Download)
- Node.js 20 or higher (Download)
- PostgreSQL 17 (Download)
- Maven 3.9+ (Download)
-
Create PostgreSQL database
CREATE DATABASE tournament_host; CREATE USER tournament_manager WITH PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE tournament_host TO tournament_manager;
-
Configure backend
cd connectFrontendWithBackend cp .env.example .env -
Edit
connectFrontendWithBackend/.env:DB_URL=jdbc:postgresql://localhost:5432/tournament_host DB_USERNAME=tournament_manager DB_PASSWORD=your_password JWT_SECRET_KEY=$(openssl rand -base64 64) SENDGRID_API_KEY=your_sendgrid_key
-
Run database migrations & start backend
./mvnw spring-boot:run
Backend will be available at: http://localhost:8080
-
Install dependencies
cd tournamentFrontend npm install -
Create frontend environment file
echo "VITE_API_BASE_URL=http://localhost:8080" > .env
-
Start development server
npm run dev
Frontend will be available at: http://localhost:5173
Interactive API documentation is available via Swagger UI:
URL: http://localhost:8080/swagger-ui.html
POST /auth/signup- Register new userPOST /auth/login- Login and get JWT tokenPOST /auth/forgot-password- Request password resetPOST /auth/reset-password- Reset password with token
GET /api/tournaments- List all tournamentsPOST /api/tournaments- Create tournamentGET /api/tournaments/{id}- Get tournament detailsPUT /api/tournaments/{id}- Update tournamentDELETE /api/tournaments/{id}- Delete tournament
POST /api/tournaments/{tournamentId}/events- Create eventPOST /api/tournaments/{tournamentId}/event/{eventIndex}/initialize- Initialize event (create matches)GET /api/tournaments/{tournamentId}/event/{eventIndex}/draw- Get event bracket/draw
GET /api/tournaments/{tournamentId}/event/{eventIndex}/matches- Get all matchesPOST /api/matches/{matchId}/result- Submit match result
For full details, visit the Swagger UI after starting the backend.
All configuration is done via environment variables (loaded from .env):
| Variable | Description | Default | Required |
|---|---|---|---|
DB_URL |
PostgreSQL connection URL | - | β |
DB_USERNAME |
Database username | tournament_manager | β |
DB_PASSWORD |
Database password | - | β |
JWT_SECRET_KEY |
Secret key for JWT tokens (64+ chars) | - | β |
JWT_EXPIRATION_TIME |
Token expiration in ms | 86400000 (24h) | β |
SENDGRID_API_KEY |
SendGrid API key for emails | - | β |
FRONTEND_URL |
Frontend URL for CORS/emails | http://localhost:5173 | β |
SERVER_PORT |
Backend server port | 8080 | β |
SPRING_PROFILES_ACTIVE |
Spring profile (dev/prod) | prod | β |
# Generate JWT secret key
openssl rand -base64 64
# Generate database password
openssl rand -base64 32# Build images
docker-compose build
# Start services
docker-compose up -d
# Check status
docker-compose ps
# View logs
docker-compose logs -f backend
docker-compose logs -f frontend
# Stop services
docker-compose down
# Stop and remove volumes (WARNING: deletes database data)
docker-compose down -vEdit .env to change ports:
BACKEND_PORT=8080 # Backend API port
FRONTEND_PORT=80 # Frontend port
DB_PORT=5432 # PostgreSQL port- Change all default passwords in
.env - Generate new
JWT_SECRET_KEY - Set
SPRING_PROFILES_ACTIVE=prod - Update
FRONTEND_URLto your domain - Configure
SENDGRID_API_KEYfor email - Set up SSL/TLS certificates
- Configure firewall rules
- Set up backup strategy for database
- Configure monitoring (optional: Sentry, Datadog)
# Production configuration
DB_PASSWORD=<strong-secure-password>
JWT_SECRET_KEY=<64-character-random-string>
SENDGRID_API_KEY=<your-sendgrid-key>
FRONTEND_URL=https://yourdomain.com
VITE_API_BASE_URL=https://api.yourdomain.com
SPRING_PROFILES_ACTIVE=prodExample Nginx config for production:
server {
listen 443 ssl http2;
server_name yourdomain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
# Frontend
location / {
proxy_pass http://localhost:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# Backend API
location /api {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Automated daily backup script:
#!/bin/bash
# backup-db.sh
docker exec tournament-postgres pg_dump -U tournament_manager tournament_host > backup_$(date +%Y%m%d).sqltournament-host/
βββ connectFrontendWithBackend/ # Spring Boot backend
β βββ src/
β β βββ main/
β β β βββ java/
β β β β βββ com/tournamenthost/
β β β β βββ Controller/ # REST endpoints
β β β β βββ Service/ # Business logic
β β β β βββ Model/ # JPA entities
β β β β βββ Repository/ # Database access
β β β β βββ Security/ # Auth & security
β β β β βββ Config/ # Configuration
β β β βββ resources/
β β β βββ application.properties
β β β βββ logback-spring.xml # Logging config
β β β βββ db/migration/ # Flyway migrations
β β βββ test/ # Tests
β βββ Dockerfile
β βββ pom.xml
β
βββ tournamentFrontend/ # React frontend
β βββ src/
β β βββ Pages/ # React pages
β β βββ Components/ # Reusable components
β β βββ utils/ # Utilities & API clients
β βββ Dockerfile
β βββ nginx.conf
β βββ package.json
β
βββ docker-compose.yml # Multi-container setup
βββ .env.example # Environment template
βββ .dockerignore
βββ README.md
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Email: support@tournamenthost.com
- Documentation: http://localhost:8080/swagger-ui.html
Built with:
Made with β€οΈ for tournament organizers worldwide