A real-time online chess game built with Django, designed specifically for users in restrictive network environments with very different Internet culture from the rest-of-world (ROW). Whether you're in a LAN-only setting or behind strict firewalls (e.g., users in China), Family Chess enables instant, seamless chess gameplay across network and cultural boundaries.
Live demo: https://family-chess.quee.org (Small 2GB VPS, please be gentle!)
- No Internet Dependency: All assets (JS, CSS, images, sounds) are hosted locally
- No Login Required: Quick access with shareable 8-digit game IDs
- Cross-Network Play: Works reliably in restricted environments and within firewalls
- Mobile-Friendly: Responsive interface with click-to-move system
- Real-time Updates: Using Server-Sent Events (SSE) for instant move synchronization
- Multilingual: Full support for English and Chinese
Both my 10 year old son living in Singapore and my father-in-law living in China loves chess. They would like to play chess, but there is no online chess platform that satisfies all of the following (ranked in terms of importance):
- Reliably accessible from both China and ROW
- Optimised for mobile-first
- No login required
Authentication | Email-based accounts, usernames | WeChat ID, mobile phone numbers | No login required. Uses shareable game IDs (expressed as a 8 digit number) instead |
CDN Access | Global CDNs (jsdelivr, cdnjs) work reliably | Western CDNs blocked or unreliable | All assets served locally. No external dependencies |
Network Environment | Generally open internet access | Completely blocked or intermittent | Works behind firewalls - Optimized for restricted networks |
Device Preference | Desktop and mobile mix | Mobile-first usage patterns | Mobile-optimized UI - Touch-friendly interface design |
Real-time Features | WebSockets widely supported | WebSocket connections often blocked | Server-Sent Events (SSE) - More reliable than WebSockets |
- chess.js: Core chess logic and move validation
- chessboard.js: Chess board UI and piece movement
- Tailwind CSS: Responsive styling and layout
- Howler.js: Audio handling for game sounds
- jQuery: DOM manipulation and AJAX requests
- Django 5.2: Server-side application framework
- python-chess: Secure chess move validation and game logic
- SQLite: Database for game state storage (PostgreSQL recommended for production)
- Server-Sent Events (SSE): Real-time game state updates with connection cleanup
- Clone the repository
- Create and activate a virtual environment
- Install dependencies
- Set up environment variables
Edit the .env file with your specific configuration:
- SECRET_KEY: Django secret key
- DEBUG: "True" for development, "False" for production
- ALLOWED_HOSTS: Comma-separated list of allowed hosts
- CSRF_TRUSTED_ORIGINS: Comma-separated list of trusted origins with scheme (http:// or https://)
For production deployment, make sure to:
-
Set DEBUG=False
-
Add your domain to ALLOWED_HOSTS (e.g., family-chess.quee.org)
-
Add your domain with scheme to CSRF_TRUSTED_ORIGINS (e.g., https://family-chess.quee.org)
-
Initialize the database
Important: Always run these migration commands after pulling updates from the repository, as the database schema may have been updated with new features or improvements.
- Compile translations (optional)
If you get an error here regarding gettext, you need to run:
- Run the development server
- CSRF Protection: All POST endpoints protected with Django CSRF tokens
- Input Validation: Chess moves validated using python-chess library
- Database Locking: Atomic operations prevent race conditions
- Session Security: Secure session handling with production-grade cookies
- Connection Limits: SSE connections auto-timeout to prevent resource exhaustion
- Security Headers: Comprehensive security headers in production configuration
The game supports multiple languages with Django's translation system:
- English (default)
- Chinese (Simplified)
- Update translation strings in the code:
- Edit translation files:
- English: game/locale/en/LC_MESSAGES/django.po
- Chinese: game/locale/zh_Hans/LC_MESSAGES/django.po
- Compile translations:
If you get an error here regarding gettext, you need to run:
Tested and supported on:
- Chrome/Edge
- Safari
- Mobile browsers: Chrome for Android, Safari for iOS
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.