Python SDK for the Paircraft API - Chess Tournament Management
Project description
Chess Tournament Director
A comprehensive chess tournament management system with React frontend and Node.js backend, featuring Swiss-system pairings, player management, and tournament analytics.
๐ Features
- Tournament Management: Create and manage chess tournaments with multiple sections
- Swiss System Pairings: Automated pairing algorithm with USCF compliance
- Player Management: Add, edit, and search players with rating lookup
- Real-time Standings: Live tournament standings with tiebreakers
- Export Capabilities: PDF reports, CSV exports, and DBF file generation
- Responsive Design: Modern React UI with Tailwind CSS
- Authentication: Secure user authentication and authorization
๐ Quick Start
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- Git
Installation
-
Clone the repository
git clone <repository-url> cd ratings
-
Install dependencies
npm run install-all
-
Set up environment variables
cp .env.example .env # Edit .env with your configuration
-
Start the development server
npm run dev
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
๐ฆ Project Structure
ratings/
โโโ client/ # React frontend application
โ โโโ src/
โ โ โโโ components/ # Reusable UI components
โ โ โโโ pages/ # Application pages
โ โ โโโ services/ # API services
โ โ โโโ contexts/ # React contexts
โโโ server/ # Node.js backend
โ โโโ routes/ # API routes
โ โโโ services/ # Business logic
โ โโโ middleware/ # Express middleware
โ โโโ database.js # Database configuration
โโโ uploads/ # File uploads
โโโ docs/ # Documentation
๐ ๏ธ Available Scripts
npm run dev- Start development server (both frontend and backend)npm run client- Start React development servernpm run server- Start Node.js backend servernpm run build- Build React app for productionnpm start- Start production servernpm run setup- Create admin user
๐ Deployment
Heroku Deployment
This application is configured for easy Heroku deployment:
-
Quick Deploy
./deploy.sh
-
Manual Deploy
- See
HEROKU_DEPLOYMENT.mdfor detailed instructions - Or follow
QUICK_DEPLOY.mdfor quick reference
- See
Environment Variables
| Variable | Description | Default |
|---|---|---|
NODE_ENV |
Environment mode | development |
PORT |
Server port | 5000 |
JWT_SECRET |
JWT token secret | Required |
CORS_ORIGIN |
CORS allowed origins | http://localhost:3000 |
๐ฏ Core Features
Tournament Management
- Create tournaments with custom settings
- Manage multiple tournament sections
- Set time controls and prize structures
- Export tournament data in multiple formats
Pairing System
- Swiss-system pairings with USCF compliance
- Automatic bye assignment
- Pairing history tracking
- Conflict resolution
Player Management
- Add players manually or import via CSV
- USCF rating lookup integration
- Player search and filtering
- Rating history tracking
Analytics & Reporting
- Real-time tournament standings
- Comprehensive tiebreaker calculations
- PDF report generation
- Tournament statistics
๐ง Technology Stack
Frontend
- React 18 - Modern React with hooks
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- Axios - HTTP client for API calls
Backend
- Node.js - JavaScript runtime
- Express.js - Web application framework
- SQLite - Lightweight database
- JWT - Authentication tokens
Additional Tools
- Helmet - Security middleware
- CORS - Cross-origin resource sharing
- Rate Limiting - API protection
- Multer - File upload handling
๐ Documentation
- Heroku Deployment Guide
- Quick Deploy Instructions
- Authentication Setup
- CSV Import Guide
- Player Search Documentation
Python SDK: Online Tournaments
The official Paircraft SDK (paircraft>=1.1.0) includes helper functions for online tournaments:
pip install --upgrade paircraft
from paircraft import ChessTournamentClient
client = ChessTournamentClient(api_key="your-api-key", base_url="https://www.paircraft.tech")
tournament = client.create_online_tournament(
name="Online Blitz Night",
platform="lichess", # or "chesscom"
rounds=3,
section="Open"
)
player_ids = client.import_players(tournament.id, [
{"name": "Test White", "section": "Open", "lichess": "white_handle"},
{"name": "Test Black", "section": "Open", "lichess": "black_handle"},
])
pairings = client.pair_round(tournament.id, round=1, section="Open")
games = client.create_online_games(tournament.id, round=1, platform="lichess", section="Open")
client.start_clocks(tournament.id, round=1, section="Open")
pairings = client.poll_results(tournament.id, round=1)
if pairings:
game = client.game_status(tournament.id, pairings[0].id, include_pgn=True)
Online helper methods include create_online_tournament, import_players, pair_round, oauth_link, create_online_games, start_clocks, poll_results, game_status, set_result, paste_pairings, and validate_usernames.
๐ค Contributing
- Fork the repository
- Create a 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 - see the LICENSE file for details.
๐ Acknowledgments
- USCF (United States Chess Federation) for pairing rules
- Chess.com for inspiration
- The open-source community for excellent tools and libraries
๐ Support
For support and questions:
- Create an issue in this repository
- Check the documentation files in the root directory
- Review the code comments for implementation details
Built with โค๏ธ for the chess community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paircraft-1.1.1.tar.gz.
File metadata
- Download URL: paircraft-1.1.1.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29e7fc490240dedc2f3a7808469d1040fb363fba7b8641790475982601be6d59
|
|
| MD5 |
9e1f0ac4b977f29af3c47168d526ac28
|
|
| BLAKE2b-256 |
69a1f183cdea2b432e8bde7f4f4082cfc564a60577ed38f81c6643b28f1f11ec
|
File details
Details for the file paircraft-1.1.1-py3-none-any.whl.
File metadata
- Download URL: paircraft-1.1.1-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2be6219b3418a4c80ff6280b8db9dd5e44dc5f7559fdbc69548c97e1aecd0eba
|
|
| MD5 |
1124b38be105eaa7f5e8aadc8f0bef23
|
|
| BLAKE2b-256 |
6b9a7e770cc94536190fc76f215b14422db4635cf17622c3ae29ef9b749040e9
|