Version 2.0 - Full-Stack Web Application
MatchMaster has been transformed from a Streamlit application to a comprehensive full-stack web application for tournament management. The platform preserves the existing Pair Table Algorithm and tournament logic while adding modern web architecture, user authentication, persistent data storage, and a sleek dark-mode interface.
- FastAPI - High-performance Python web framework
- PostgreSQL - Robust relational database
- SQLAlchemy - Python SQL toolkit and ORM
- JWT Authentication - Secure token-based authentication
- Pydantic - Data validation using Python type annotations
- Next.js 14 - React framework with App Router
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Zustand - Lightweight state management
- React Hook Form - Performant forms with easy validation
- Lucide React - Beautiful & consistent icons
The project uses a custom match scheduling algorithm named PAIR TABLE ALGORITHM. This algorithm was inspired by older versions of standard match making which is favorable for "between tournament country travels". This algorithm is optimal for:
- Fair rest days for all teams
- Strategic home ground plays
- Reduced inter-country travel
- Balanced tournament scheduling
- User Authentication - Secure registration and login system
- Tournament Management - Create and manage tournaments with comprehensive settings
- Team Organization - Add teams with home ground assignments and detailed profiles
- Smart Scheduling - Automated match scheduling using the Pair Table Algorithm
- Real-time Points Table - Live updates using existing PointsTable.py logic
- Match Management - Input results and track match progress
- Analytics Dashboard - Performance metrics and tournament insights
- Super Admin - Full system access and user management
- Tournament Admin - Create/manage tournaments and teams
- Team Manager - Manage assigned teams and view results
- Viewer - Read-only access to public tournaments
All existing Python classes and algorithms have been integrated without modification:
Structures/Dequeue.py- Queue management for tournament operationsStructures/Graph.py- Fully connected undirected graphs for match relationshipsStructures/PointsTable.py- Points calculation and ranking systemStructures/Scheduler.py- Match scheduling implementation with Pair Table AlgorithmStructures/Stack.py- Stack operations for tournament data
- RESTful API - Clean API design with FastAPI
- Database Persistence - PostgreSQL with proper relationships
- Authentication & Authorization - JWT-based security
- Responsive Design - Mobile-first dark theme interface
- State Management - Efficient client-side state handling
MatchMaster/
├── backend/
│ ├── main.py # FastAPI application
│ ├── database.py # Database configuration
│ ├── models.py # SQLAlchemy models
│ ├── schemas.py # Pydantic schemas
│ ├── auth.py # Authentication logic
│ ├── services/
│ │ └── tournament_service.py # Tournament business logic
│ └── requirements.txt
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── page.tsx # Landing page
│ │ ├── login/ # Authentication pages
│ │ ├── register/
│ │ ├── dashboard/ # Main dashboard
│ │ └── tournaments/ # Tournament management
│ ├── components/ # Reusable UI components
│ │ ├── ui/ # Base UI components
│ │ ├── layout/ # Layout components
│ │ └── tournaments/ # Tournament-specific components
│ └── lib/ # Utilities and configuration
│ ├── api.ts # API client
│ ├── store.ts # State management
│ └── utils.ts # Helper functions
├── Structures/ # Original tournament logic (preserved)
│ ├── Dequeue.py
│ ├── Graph.py
│ ├── PointsTable.py
│ ├── Scheduler.py
│ └── Stack.py
└── CLI Version/ # Original CLI implementation
- Node.js 18+ and npm
- Python 3.8+
- PostgreSQL 12+
-
Install Python dependencies:
cd backend pip install -r requirements.txt -
Configure environment variables:
cp .env.example .env # Edit .env with your database credentials -
Set up PostgreSQL database:
CREATE DATABASE matchmaster; CREATE USER matchmaster_user WITH PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE matchmaster TO matchmaster_user;
-
Run the backend server:
python main.py
-
Install Node.js dependencies:
npm install
-
Configure environment variables:
cp .env.local.example .env.local # Edit .env.local with your API URL -
Run the development server:
npm run dev
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
The FastAPI backend automatically generates interactive API documentation available at /docs endpoint. Key endpoints include:
POST /auth/register- User registrationPOST /auth/login- User loginGET /auth/profile- Get user profile
GET /tournaments- List all tournamentsPOST /tournaments- Create new tournamentGET /tournaments/{id}- Get tournament detailsPOST /tournaments/{id}/schedule- Schedule matches using Pair Table Algorithm
POST /tournaments/{id}/teams- Add team to tournamentGET /tournaments/{id}/matches- Get tournament matchesPUT /matches/{id}- Update match resultsGET /tournaments/{id}/points-table- Get live points table
The original scheduling algorithm has been seamlessly integrated into the web application:
- Preserves all original logic and data structures
- Maintains optimal scheduling for fair rest days
- Supports home ground advantage distribution
- Minimizes travel requirements between matches
- Uses original
PointsTable.pywith quicksort implementation - Live updates when match results are entered
- Maintains last 5 matches history using Stack data structure
- Supports multiple sorting and filtering options
- Dark theme optimized for extended use
- Responsive design for all device sizes
- Intuitive navigation and user experience
- Real-time updates and notifications
- JWT Authentication - Secure token-based authentication
- Password Hashing - bcrypt with salt rounds
- Role-based Access Control - Granular permissions
- Input Validation - Comprehensive data validation
- SQL Injection Prevention - Parameterized queries
- CORS Protection - Configured for secure cross-origin requests
# Backend tests
cd backend
pytest
# Frontend tests
npm testThe application uses SQLAlchemy for database management. Models are automatically created on startup.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
The application has been completely rewritten while preserving all core tournament logic:
- All original Python classes and algorithms
- Pair Table Algorithm implementation
- Tournament scheduling logic
- Points calculation system
- Data structures (Stack, Deque, Graph)
- Modern web architecture with FastAPI + Next.js
- User authentication and authorization
- Persistent database storage
- RESTful API design
- Responsive dark theme interface
- Real-time updates and notifications
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue on GitHub or contact the development team.
MatchMaster v2.0 - Tournament management reimagined with modern web technology while preserving the proven Pair Table Algorithm.