A modern, real-time gaming leaderboard built with Amazon ElastiCache Serverless for Valkey, AWS Lambda, and API Gateway. Features a beautiful, responsive UI with live data persistence and automatic score ranking.
┌─────────────────────────────────────────────────────────────────────────────┐
│ VALKEY LEADERBOARD SYSTEM │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────────────┐
│ │ │ │ │ │
│ API Gateway │────│ Lambda Function │────│ ElastiCache Valkey │
│ (HTTP API) │ │ (Python 3.9) │ │ Serverless │
│ │ │ │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────────────────┘
│ │ │
│ │ │
HTTP Requests VPC Network TLS Encryption
│ │ │
│ │ │
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────────────┐
│ │ │ │ │ │
│ Client Apps │ │ Security Groups │ │ Data Structures │
│ • Web Apps │ │ • Port 6379 │ │ • Hash: User Profiles │
│ • Mobile Apps │ │ • TLS Security │ │ • Sorted Set: Leaderboard │
│ • GitHub Pages │ │ • VPC Isolation │ │ • String+TTL: Sessions │
│ │ │ │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────────────────┘
Data Flow:
- User interacts with web interface (GitHub Pages)
- API Gateway handles HTTP requests with CORS
- Lambda processes business logic in VPC
- ElastiCache Serverless for Valkey stores leaderboard data with TLS
- Real-time updates flow back through the same path
- ⚡ Real-time Updates: Live leaderboard with instant score updates
- 🎨 Modern UI: Clean, responsive design with smooth animations
- ☁️ Serverless Architecture: Fully managed AWS infrastructure
- 🔒 Secure: TLS encryption, VPC isolation, CORS configuration
- 📱 Mobile-Friendly: Responsive design works on all devices
- 🎯 Score Validation: Automatic score capping and validation
- 🏆 Live Rankings: Automatic sorting and ranking system
- Frontend: HTML5, CSS3, Vanilla JavaScript
- Backend: AWS Lambda (Python 3.9)
- Database: Amazon ElastiCache Serverless for Valkey 8.1
- API: AWS API Gateway with CORS
- Infrastructure: AWS VPC, Security Groups, TLS
To deploy your own version, you'll need:
- AWS Account with appropriate permissions
- AWS CLI configured
- Basic knowledge of AWS services (Lambda, API Gateway, ElastiCache)
git clone https://github.com/YOUR_USERNAME/valkey-serverless-leaderboard.git
cd valkey-serverless-leaderboard- Create ElastiCache Serverless for Valkey cluster
- Deploy Lambda function with Valkey connectivity
- Set up API Gateway with proper CORS configuration
- Configure VPC and security groups
Edit index.html and replace the API URL:
const API_URL = 'YOUR_API_GATEWAY_URL_HERE'; // Replace with your API Gateway URL- Push your code to GitHub
- Enable GitHub Pages in repository settings
- Point to
index.htmlas the main page
- Add Scores: Enter player name and score (max 1000 points)
- View Leaderboard: See real-time rankings with live updates
- Test Connection: Use the health check to verify connectivity
- Refresh Data: Manually refresh to see latest scores
GET /health- Health check and connectivity testGET /leaderboard- Retrieve current leaderboardPOST /score- Add or update player score
The leaderboard comes with realistic sample data:
- Players with varied, realistic names
- Scores distributed between 500-1000 points
- Proper ranking and sorting
- TLS Encryption: All data in transit is encrypted
- VPC Isolation: Database runs in private VPC
- CORS Configuration: Proper cross-origin resource sharing
- Input Validation: Score limits and data validation
- Rate Limiting: API Gateway throttling protection
- Desktop: Full-featured experience with all controls
- Tablet: Optimized layout with touch-friendly interface
- Mobile: Compact design with essential functionality
- Modern Flat Design: Clean, professional appearance
- Smooth Animations: Hover effects and transitions
- Color-Coded Rankings: Visual distinction for top players
- Loading States: Clear feedback during operations
- Error Handling: User-friendly error messages
- Sub-millisecond Queries: Valkey's high-performance data structure
- Serverless Scaling: Automatic scaling based on demand
- CDN Delivery: Fast content delivery via GitHub Pages
- Optimized Code: Minimal JavaScript for fast loading
- Real-time Logs: CloudWatch integration for monitoring
- Health Checks: Built-in connectivity testing
- Error Tracking: Comprehensive error logging
- Performance Metrics: Response time and throughput tracking
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Amazon Web Services for the robust cloud infrastructure
- Valkey Community for the high-performance data store
- Open Source Community for inspiration and best practices
For questions or issues:
- Check the documentation in this repository
- Review AWS ElastiCache Serverless documentation
- Open an issue on GitHub
Built with ❤️ using Amazon ElastiCache Serverless for Valkey 8.1