A modern single-player implementation of the popular Exploding Kittens card game with user authentication and leaderboards.
- Single Player Game - Draw cards and avoid exploding kittens
- User Authentication - JWT-based registration and login
- Score Tracking - Personal scores and global leaderboard
- Flexible Storage - Redis or in-memory storage via configuration
- Responsive Design - Works on all screen sizes (100vh/100vw)
- Real-time Feedback - Toast notifications for all actions
Backend: Go + Gin + Redis/Memory Storage
Frontend: React + Vite + Redux + Framer Motion
Database: Redis (production) / In-Memory (free tier)
Deployment: Render + Vercel
- Interface-based design - Single codebase supports multiple storage types
- Environment-driven - Switch storage via
USE_MEMORY_STOREvariable - Production ready - Redis for persistence, Memory for free deployment
| Environment | Storage Type | Persistence | Cost |
|---|---|---|---|
| Development | Redis (local) | โ Persistent | Free |
| Production (Free) | In-Memory | โ Resets on restart | Free |
| Production (Paid) | Redis Cloud | โ Persistent | $7+/month |
- Go 1.21+
- Node.js 18+
- Redis (for local development)
- Clone and setup
git clone https://github.com/yourusername/exploding-kittens.git
cd exploding-kittens- Test with Redis (Recommended)
# Start Redis
docker-compose up -d redis
# Backend with Redis
cd backend
cp .env.example .env
# Edit .env: USE_MEMORY_STORE=false
go mod tidy
# Set environment and run
$env:USE_MEMORY_STORE="false"; go run main.go
# Frontend
cd ../frontend
cp .env.example .env
npm install
npm run dev- Test with Memory Storage
# Backend with Memory
cd backend
# Set environment and run
$env:USE_MEMORY_STORE="true"; go run main.go
# Frontend (same as above)
cd ../frontend
npm run devVisit: http://localhost:5173
Backend Environment Variables:
# Required
ENVIRONMENT=production|development
PORT=8080
JWT_SECRET=your-secret-key
# Storage Selection
USE_MEMORY_STORE=true|false
# Redis (if USE_MEMORY_STORE=false)
REDIS_URL=redis://user:pass@host:port
REDIS_ADDR=localhost:6379 # for development
# CORS
ALLOWED_ORIGINS=https://your-frontend-domain.comFrontend Environment Variables:
VITE_ENVIRONMENT=production|development
VITE_API_URL=https://your-backend-domain.com- Connect GitHub repo to Render
- Render auto-detects
render.yaml - Free Tier: Uses in-memory storage (
USE_MEMORY_STORE=true) - Paid Tier: Add Redis service and set
USE_MEMORY_STORE=false
- Connect GitHub repo to Vercel
- Set root directory to
frontend - Environment variables set automatically via
vercel.json
- Register/Login to save your scores
- Start Game - Click to begin drawing cards
- Card Types:
- ๐ธ Cat Cards - Safe, go to inventory
- ๐ก๏ธ Defuse Cards - Protect against bombs
- โญ๏ธ Skip Cards - Safe, just removed
- ๐ Shuffle Cards - Reshuffle the deck
- ๐ฅ Bomb Cards - Game over unless you have defuse
- Win Condition - Draw all cards without exploding
- Scoring - Each win increases your score
โโโ render.yaml # Render deployment config
โโโ docker-compose.yml # Redis for local development
โโโ LICENSE # MIT License
โโโ backend/ # Go API server
โ โโโ config/ # Environment configuration
โ โโโ handlers/ # HTTP request handlers
โ โโโ middleware/ # Auth, CORS, rate limiting
โ โโโ services/ # Business logic & storage
โ โ โโโ storageService.go # Storage abstraction
โ โ โโโ redisStorage.go # Redis implementation
โ โ โโโ memoryStorage.go # Memory implementation
โ โ โโโ authService.go # Authentication logic
โ โโโ models/ # Data models
โ โโโ main.go # Application entry point
โ โโโ go.mod # Go dependencies
โ โโโ .env.example # Environment template
โโโ frontend/ # React application
โ โโโ src/
โ โ โโโ components/ # React components
โ โ โโโ config/ # Environment config
โ โ โโโ state/ # Redux store
โ โโโ vercel.json # Vercel deployment
โ โโโ package.json # Node dependencies
โ โโโ .env.example # Environment template
users- Complete user profiles (ID, username, email, password hash, scores)usernames- Username to user ID mapping for fast lookupscores- Username to score mapping for leaderboard
- Same structure as Redis but stored in application memory
- Data resets when server restarts (every ~15 minutes of inactivity on free tier)
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/profile- Get user profile (requires auth)POST /api/game/user- Update user scoreGET /api/game/user/:username- Get user scoreGET /api/game/leaderboard- Get game leaderboard
cd backend
docker-compose up -d redis
$env:USE_MEMORY_STORE="false"; go run main.go
# Check logs: "Using Redis storage"cd backend
$env:USE_MEMORY_STORE="true"; go run main.go
# Check logs: "Using in-memory storage"- JWT Authentication - Secure token-based auth
- Password Hashing - bcrypt with salt rounds
- CORS Protection - Configured for specific domains
- Rate Limiting - Prevents API abuse
- Environment Secrets - No hardcoded credentials
- Redis: Sub-millisecond data access, persistent storage
- Memory: Nanosecond access, no network overhead
- Frontend: Optimized bundle, lazy loading, responsive design
- Backend: Efficient Go runtime, minimal dependencies
MIT License - see LICENSE file for details
- Fork the repository
- Create your 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