Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

242 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TourneyProject - Tournament Management System

A full-stack tournament management platform with automated single-elimination bracket generation, built as a collaborative academic project to replicate real-world software development practices.

Overview

TourneyProject is a comprehensive tournament management system that allows users to create and manage competitive tournaments with automatic bracket generation. The platform features user authentication, team management, match tracking, and real-time tournament progression through single-elimination brackets.

This project was developed as a realistic study project simulating professional software development workflows, including project management, task delegation, and cross-functional team collaboration.

Features

  • User Management

    • JWT-based authentication with refresh tokens
    • Role-based access control (Admin/User)
    • Secure password hashing with ASP.NET Core Identity
  • Tournament Management

    • Create and manage tournaments with customizable settings
    • Automatic single-elimination bracket generation
    • Tournament status tracking (NotStarted, InProgress, Finished, Cancelled)
    • Resource-based authorization (only tournament creators and admins can modify)
  • Team Management

    • Create teams with multiple members
    • Team registration for tournaments
    • Track team statistics and tournament history
  • Match System

    • Automated match creation based on bracket structure
    • Match result recording
    • Progress tracking through tournament stages
    • Automatic winner advancement
  • Security & Authorization

    • JWT Bearer token authentication
    • Resource-based authorization policies
    • Role-based permissions (Admin, User)
    • Secure API endpoints with Swagger documentation

Technology Stack

Backend

  • Framework: ASP.NET Core 9.0 Web API
  • Database: PostgreSQL
  • ORM: Entity Framework Core
  • Authentication: JWT Bearer Tokens with ASP.NET Core Identity
  • Documentation: Swagger/OpenAPI
  • Testing: xUnit

Frontend

  • Framework: React 18
  • Language: TypeScript
  • Build Tool: Vite
  • Routing: React Router 7
  • State Management: Zustand
  • HTTP Client: Axios
  • Code Quality: ESLint, Prettier

Infrastructure

  • Containerization: Docker & Docker Compose
  • Database: PostgreSQL (containerized)
  • Reverse Proxy/Static Hosting: ASP.NET Core serves React build

Quick Start

Prerequisites

  • Docker
  • Docker Compose

Deployment

  1. Clone the repository:
git clone <repository-url>
cd tourneyProject
  1. Create .env file in the root directory with the following parameters:

Tip: Copy .env.example and fill in your values: cp .env.example .env

ENVIRONMENT=Production
DB_PASSWORD=your_database_password
JWT_SECRET_KEY=your_secret_key_at_least_32_chars_long
JWT_ISSUER=TourneyAPI
JWT_AUDIENCE=TourneyClient
JWT_TOKEN_EXPIRY_MINUTES=60
JWT_REFRESH_EXPIRY_DAYS=7
VITE_BASE_URL=http://localhost:5188/api
  1. Build and run the application:
docker-compose up --build
  1. Access the application:

Default Admin Credentials

Email: admin@admin.com
Password: Admin123!

SECURITY WARNING:

  • Change the default admin credentials immediately in production environments
  • Use strong, unique passwords
  • Never commit .env files or files containing real credentials to version control
  • Generate secure JWT secret keys using: openssl rand -base64 32

Development Setup

Backend Development

  1. Install prerequisites:

    • .NET 9.0 SDK
    • PostgreSQL
  2. Navigate to API directory:

cd api/src/TourneyAPI
  1. Install EF Core tools:
dotnet tool install --global dotnet-ef
  1. Set up database:
# Create PostgreSQL database
sudo -u postgres psql
postgres=# CREATE DATABASE tourneydb;
postgres=# CREATE USER your_username WITH ENCRYPTED PASSWORD 'your_password';
postgres=# GRANT ALL PRIVILEGES ON DATABASE tourneydb TO your_username;

# Apply migrations
dotnet ef database update
  1. Run the API:
dotnet run

Frontend Development

  1. Navigate to UI directory:
cd ui
  1. Install dependencies:
npm install
  1. Start development server:
npm run dev
  1. Build for production:
npm run build

Testing

Run unit tests:

cd api/tests/TourneyAPI.Tests
dotnet test

Project Structure

tourneyProject/
├── api/                        # Backend API
│   ├── src/TourneyAPI/
│   │   ├── Authorization/      # Custom authorization handlers
│   │   ├── Data/               # EF Core DbContext and configurations
│   │   ├── Endpoints/          # Minimal API endpoints
│   │   ├── Models/             # Domain models and DTOs
│   │   ├── Services/           # Business logic services
│   │   │   └── BracketGenerators/  # Tournament bracket algorithms
│   │   └── Migrations/         # EF Core migrations
│   └── tests/                  # Unit tests
├── ui/                         # React frontend
│   ├── src/
│   │   ├── components/         # React components
│   │   ├── pages/              # Page components
│   │   └── utils/              # Utility functions
├── docs/                       # Project documentation
├── layout/                     # Initial HTML/CSS prototypes
├── docker-compose.yml          # Docker orchestration
└── Dockerfile                  # Multi-stage build

Architecture

Backend Architecture

  • Minimal APIs: Endpoint definitions using ASP.NET Core Minimal API pattern
  • Service Layer: Business logic abstracted into service interfaces
  • Repository Pattern: Entity Framework Core as abstraction over PostgreSQL
  • Authorization: Custom resource-based authorization handlers for fine-grained permissions
  • Dependency Injection: Built-in ASP.NET Core DI container

Frontend Architecture

  • Component-Based: Modular React components
  • State Management: Zustand for global state
  • Type Safety: Full TypeScript coverage
  • Routing: React Router for SPA navigation

Contributors

This project was developed by a collaborative student team:

Name Role Responsibilities
Egor Project Lead & Backend Developer Project management, task coordination, API architecture, backend infrastructure, database design, authentication system, authorization policies, service layer implementation, Docker configuration
Sergey Frontend Developer (Layout) HTML/CSS markup, responsive design, UI implementation
Nikita Frontend Developer (Logic) React components, state management, API integration, frontend business logic
Alexander Server Deployment Server configuration for the demo deployment
Svyatoslav UI/UX Designer Interface design, user experience, Figma prototypes

API Documentation

API documentation is available through Swagger UI when running in Development mode:

Key Endpoints

  • POST /api/users/register - User registration
  • POST /api/users/login - User authentication
  • GET /api/tournaments - List all tournaments
  • POST /api/tournaments - Create tournament (authenticated)
  • POST /api/teams - Create team
  • PUT /api/matches/{id} - Update match results

Security Features

  • Password hashing with ASP.NET Core Identity
  • JWT token-based authentication
  • Refresh token rotation
  • Role-based authorization (Admin, User)
  • Resource-based authorization for tournaments, teams, and matches
  • CORS configuration for cross-origin requests
  • Data protection keys persisted in Docker volumes

Docker Services

API Service

  • Port: 5188
  • Auto-migration on startup
  • Serves both API and static React build
  • Data protection keys volume

Database Service

  • PostgreSQL latest
  • Health checks configured
  • Persistent data volume
  • Automatic initialization

Stopping the Application

Stop containers:

docker-compose down

Remove all data (including database):

docker-compose down -v

License

This is an academic project developed for educational purposes.

About This Project

This project was created as a realistic study project to simulate professional software development practices. It demonstrates:

  • Full-stack development with modern technologies
  • RESTful API design principles
  • Authentication and authorization patterns
  • Database design and ORM usage
  • Docker containerization
  • Team collaboration and project management
  • Git workflow and version control
  • Testing methodologies

The project was led by the backend developer who managed the team, coordinated tasks, and was responsible for the complete backend architecture and infrastructure setup.

About

Full-stack tournament management system with single-elimination bracket generation. Built with ASP.NET Core 9.0 Web API, PostgreSQL, and React TypeScript frontend. Features JWT authentication, role-based access control, automated bracket generation, and Docker containerized deployment. Academic project demonstrating real-world software development.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages