🎮 Play the GitHub Pages version instantly! - No setup required!
This project includes two versions:
- GitHub Pages Edition: Static version that works in any browser without a server
- Enhanced Server Edition: Full-featured Flask-SocketIO version with real-time multiplayer
The GitHub Pages version is a complete standalone implementation that includes:
- ✅ All 10 achievements
- ✅ 5 progressive levels with visual/audio effects
- ✅ Real-time statistics and session tracking
- ✅ Persistent progress (localStorage)
- ✅ Mobile-friendly responsive design
- ✅ Sound effects and confetti animations
- ✅ No installation required
This is a significantly improved multi-user button clicking game built with Flask and Socket.IO. The enhanced version includes better architecture, error handling, performance optimizations, security features, and comprehensive logging.
- Modular Design: Code split into logical modules (
config.py,data_manager.py,rate_limiter.py) - Configuration Management: Environment-based configuration with
.envfile support - Application Factory: Proper Flask application factory pattern
- Thread Safety: All file operations are thread-safe with proper locking
- Rate Limiting: Prevents spam clicking with configurable limits (600 clicks/minute default)
- Connection Limiting: Limits concurrent connections to prevent server overload
- Atomic File Operations: Ensures data integrity during saves
- Background Cleanup: Automatic cleanup of old data and rate limiting entries
- Memory Optimization: Efficient data structures and cleanup routines
- Input Validation: All user inputs are properly validated
- CORS Configuration: Configurable CORS settings for security
- Error Handling: Comprehensive error handling with proper logging
- Session Management: Improved client session tracking
- Automatic Backups: Regular backups of all data files
- Data Recovery: Automatic recovery from corrupted data files
- Versioned Data: Data format versioning for future compatibility
- Organized Storage: All data stored in a dedicated
data/directory
- Structured Logging: Proper logging with different levels and file output
- Health Check Endpoint:
/api/healthfor monitoring server status - Performance Metrics: Track connections, response times, and system health
- Debug Information: Comprehensive debug output for troubleshooting
- Python 3.8+ installed
- Internet connection for downloading dependencies
-
Clone or download the project
-
Install dependencies:
pip install -r requirements.txt
-
Optional: Configure environment
cp .env.example .env # Edit .env file to customize settings -
Run the application:
python app.py
-
Access the application:
- Local:
http://localhost:5000 - Network:
http://YOUR_IP_ADDRESS:5000(shown in terminal)
- Local:
Create a .env file to customize the application:
# Server Settings
FLASK_ENV=development
PORT=5000
HOST=0.0.0.0
# Performance Settings
MAX_CONNECTIONS=1000
RATE_LIMIT_PER_MINUTE=600
# Feature Flags
ENABLE_ACHIEVEMENTS=True
ENABLE_STATS=True
ENABLE_BACKUPS=True
# Logging
LOG_LEVEL=INFO
# Security
SECRET_KEY=your-secret-key
CORS_ORIGINS=*The button evolves through 5 distinct levels as you click:
- Level 1 (0-500 clicks): Simple button with minimal styling
- Level 2 (500-1000 clicks): Enhanced appearance and animations
- Level 3 (1000-1500 clicks): Exciting effects with background music
- Level 4 (1500-2000 clicks): Advanced visual effects and haptic feedback
- Level 5 (2000+ clicks): Epic button with maximum visual chaos
- Synchronized Clicks: All clicks are synchronized across all connected users
- Live Updates: See other players' clicks in real-time
- Session Tracking: Advanced user session management
- Connection Status: Real-time connection status indicators
- Progressive Achievements: Unlock achievements as you reach milestones
- Global Tracking: Achievements are tracked globally and per-user
- Visual Notifications: Beautiful achievement unlock animations
- Secret Achievements: Hidden achievements to discover (hint: try the Konami code!)
- Click Tracking: Detailed statistics on clicks per hour, day, and user
- User Analytics: Track unique users and session data
- Performance Metrics: Monitor server performance and response times
- Data Export: All statistics available via REST API
- Responsive Design: Works perfectly on all device sizes
- Touch Support: Optimized touch controls for mobile devices
- Haptic Feedback: Vibration feedback on supported mobile devices
- Offline Capability: Limited offline functionality with local storage
- Dynamic Sound System: Different sounds for each button level
- Visual Effects: Confetti, animations, and particle effects
- Progressive Enhancement: Effects become more elaborate as you progress
- Sound Toggle: Easy mute/unmute functionality
The enhanced version includes a REST API for monitoring and integration:
GET /api/health
Returns server status, version, uptime, and connection count.
GET /api/stats
Returns detailed click statistics, user data, and hourly breakdown.
GET /api/achievements
Returns all unlocked achievements and player progress.
├── app.py # Main application with enhanced architecture
├── config.py # Configuration management
├── data_manager.py # Data persistence and backup handling
├── rate_limiter.py # Rate limiting and connection management
├── index.html # Interactive frontend with all features
├── requirements.txt # Python dependencies
├── .env.example # Environment configuration template
├── test_enhanced.py # Comprehensive test suite
├── data/ # Data storage directory
│ ├── button_clicks.json # Persistent click data
│ ├── achievements.json # Achievement data
│ ├── stats.json # Statistics and user data
│ ├── app.log # Application logs
│ └── backups/ # Automatic backup storage
└── README.md # This file
All data is automatically saved and backed up:
- Atomic Saves: Data is saved atomically to prevent corruption
- Automatic Backups: Daily backups of all data files
- Backup Rotation: Keeps last 7 backups by default
- Corruption Recovery: Automatic recovery from corrupted files
- Cross-Platform: Works on Windows, Linux, and macOS
The enhanced version is optimized for performance:
- Rate Limiting: Prevents abuse and ensures fair usage
- Connection Management: Handles up to 1000 concurrent connections
- Memory Efficient: Optimized data structures and cleanup routines
- Background Processing: Non-blocking background tasks
- Caching: Intelligent caching of frequently accessed data
- Input Validation: All user inputs are validated and sanitized
- Rate Limiting: Protects against spam and abuse
- Session Security: Secure session management
- CORS Protection: Configurable CORS settings
- Error Handling: Secure error handling without information disclosure
Run the comprehensive test suite:
# Run all tests
python test.py
# Run quick tests (without server dependency)
python test.py --quickApplication logs are stored in data/app.log with configurable log levels.
Use the /api/health endpoint to monitor server status in production.
Backups are automatically created and rotated. Manual backups can be triggered through the API.
- Port Already in Use: Change the PORT in
.envfile - Permission Errors: Ensure write permissions for the
data/directory - Rate Limited: Wait or adjust
RATE_LIMIT_PER_MINUTEin configuration - Connection Issues: Check firewall settings and network configuration
Enable debug mode for development:
FLASK_ENV=development
DEBUG=True
LOG_LEVEL=DEBUGThis enhanced version provides a solid foundation for further improvements:
- Fork the repository
- Create a feature branch
- Make your changes
- Run the test suite
- Submit a pull request
This project is open source and available under the MIT License.