A creative circle-drawing game with real-time leaderboards powered by MongoDB and Deno 2.
- Perfect Circle Challenge: Draw circles and get scored on precision
- MongoDB Leaderboards: Persistent global rankings
- Real-time Competition: See how you rank against other players
- Dark Mode: Beautiful light/dark themes
- Detailed Scoring: Circularity, Closure, and Smoothness metrics
- Mobile Responsive: Works on all devices
git clone <your-repo>
cd cirkleFor persistent global leaderboards, use MongoDB Atlas:
- Follow the detailed setup guide: See
SETUP_MONGODB_ATLAS.mdfor complete step-by-step instructions - Quick setup: Copy the template and configure your connection
cp env.template .env # Edit .env with your MongoDB Atlas connection string
For quick testing without setup:
# Just run the app - it will use localStorage
deno task dev
# ⚠️ Leaderboard data will be local only# Install MongoDB locally
brew install mongodb/brew/mongodb-community # macOS
# Start MongoDB
brew services start mongodb/brew/mongodb-community
# Create .env file
echo "MONGODB_URI=mongodb://localhost:27017/cirkle" > .envdeno task devVisit http://localhost:8000 and start drawing circles! 🎨
GET /api/leaderboard- Get top 50 scoresPOST /api/leaderboard- Submit new scoreGET /api/leaderboard/stats- Get statisticsDELETE /api/leaderboard- Clear all scores (admin)
interface LeaderboardEntry {
name: string;
score: number; // 0-100%
date: string; // ISO timestamp
metrics: {
circularityScore: number;
closureScore: number;
smoothnessScore: number;
};
}If MongoDB is unavailable, the app automatically falls back to localStorage for offline functionality.
- Draw a Circle: Click and drag to draw a circle anywhere on the page
- Get Scored: Algorithm analyzes your circle's perfection (0-100%)
- Make the Leaderboard: Scores ≥70% prompt for your name
- Compete: Check the 🏆 leaderboard to see global rankings
- Improve: Try to join the elite 95% Club!
cirkle/
├── main.ts # Deno server with MongoDB integration
├── deno.json # Deno configuration & dependencies
├── public/
│ ├── index.html # Main application
│ ├── style.css # Responsive styling
│ └── script.js # Circle drawing & leaderboard logic
└── README.md
- Backend: Deno 2 with MongoDB integration
- Frontend: Vanilla JavaScript with HTML5 Canvas
- Database: MongoDB with automatic fallback to localStorage
- Styling: Modern CSS with glassmorphism effects
- Algorithm: Mathematical circle analysis with 4 metrics
The app automatically creates:
leaderboardcollection with score/date indexes- Efficient queries for top scores and statistics
- Caching: Static assets cached for 1 hour
- Indexing: MongoDB indexes for fast leaderboard queries
- Graceful Degradation: Automatic fallback to localStorage
- CORS: Enabled for cross-origin requests
Circles are scored on:
- Circularity (55%): How round your shape is
- Closure (30%): How well you complete the loop
- Smoothness (15%): How fluid your drawing motion is
Target: 95%+ to join the elite circle masters! 👑
- 🌙 Dark Mode: Toggle between light/dark themes
- 📱 Mobile Ready: Touch support and responsive design
- 🎉 Celebrations: Confetti and animations for high scores
- ⌨️ Shortcuts: Ctrl+C (clear), Ctrl+R (particles), Ctrl+Shift+C (tips)
- 🔧 Developer Tools: Console logging and performance metrics
Pull requests welcome! Areas for improvement:
- Advanced scoring algorithms
- Multiplayer competitions
- Social features
- Performance optimizations
MIT License - feel free to use this code for your own projects!
Happy Circle Drawing! 🎯✨