Learn coding by creating games with natural language
Features • Demo • Quick Start • Documentation • Deploy
Games.Random is an innovative AI-powered platform that transforms natural language descriptions into fully playable 2D games. Designed for learners, educators, and game enthusiasts, it makes game development accessible to everyone—no coding experience required.
Simply describe the game you want to create, choose a library (p5.js or Phaser 3), and watch as Claude AI generates clean, commented code that you can play, learn from, and modify.
- Generate complete 2D games from natural language descriptions
- Powered by Claude Sonnet 4.5 (Anthropic's latest model)
- Real-time streaming code generation with Server-Sent Events
- Support for p5.js and Phaser 3 game libraries
- Instant playback: Play generated games immediately in your browser
- Code assistant chatbot: Ask questions and get help modifying your game
- Live code editor: View and edit generated code in real-time
- Educational comments: Code includes explanatory comments for learning
- Google OAuth authentication: Secure sign-in with your Google account
- Personal game library: Save and manage your generated games
- User profiles: Track your creations and progress
- Rate limiting: 3 game generations per 24 hours (IP-based)
- Session management: Secure user sessions with Passport.js
- MongoDB integration: Persistent storage for user data and games
- Error handling: Graceful error messages and recovery
- Fully containerized: Docker and Docker Compose support
- Health checks: Automatic service monitoring
- Environment configuration: Easy setup with .env files
- Deployment configs: Ready for Railway, Render, and more
- Dark theme: Beautiful, modern interface with glassmorphic design
- Responsive design: Works on desktop, tablet, and mobile
- Real-time feedback: Live updates during code generation
- Keyboard shortcuts: Shift+Enter to generate games
-
Describe your game
"Create a flappy bird game with a batman theme" -
Choose a library
- p5.js: Perfect for simple games and visual sketches
- Phaser 3: Ideal for advanced games with physics
-
Click Generate and watch the magic happen! ✨
- 🏓 Pong with custom scoring
- 🐍 Snake game with obstacles
- 🦅 Flappy Bird variations
- 👾 Space Invaders clones
- 🎯 Platformer games
- 🎰 Puzzle games
- And many more!
┌─────────────────────────────────────────────────────────────┐
│ User Browser │
│ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ Game UI │ │ Auth System │ │ Game Library │ │
│ └──────────────┘ └──────────────┘ └─────────────────┘ │
└────────────────────────────┬────────────────────────────────┘
│ HTTPS
▼
┌─────────────────────────────────────────────────────────────┐
│ Express.js Server │
│ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │
│ │ API Routes │ │ Streaming │ │ Rate Limiter │ │
│ └──────────────┘ └──────────────┘ └─────────────────┘ │
└─────────┬───────────────────┬───────────────────┬──────────┘
│ │ │
▼ ▼ ▼
┌──────────────────┐ ┌──────────────┐ ┌──────────────────┐
│ Claude AI API │ │ MongoDB │ │ Passport OAuth │
│ (Anthropic) │ │ Database │ │ (Google) │
└──────────────────┘ └──────────────┘ └──────────────────┘
- Node.js v20 or higher
- npm or yarn
- Anthropic API key (get one at console.anthropic.com)
- Docker (optional, for containerized deployment)
-
Clone the repository
git clone https://github.com/Muhammad-Rayyan-Moosani/Games.Random.git cd Games.Random -
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env
Edit
.envand add your credentials:ANTHROPIC_API_KEY=your-api-key-here GOOGLE_CLIENT_ID=your-google-client-id (optional) GOOGLE_CLIENT_SECRET=your-google-client-secret (optional) SESSION_SECRET=your-random-secret MONGODB_URI=mongodb://localhost:27017/games-random (optional) PORT=3000
-
Start the application
npm start
-
Open your browser
http://localhost:3000
That's it! 🎉
Run the entire stack with one command:
docker-compose up -dThis starts:
- ✅ Games.Random application
- ✅ MongoDB database
- ✅ Automatic networking and volumes
Stop the application:
docker-compose downFor detailed Docker instructions, see DOCKER.md.
- Runtime: Node.js v20
- Framework: Express.js
- AI: Anthropic Claude API (Sonnet 4.5)
- Database: MongoDB with Mongoose
- Authentication: Passport.js + Google OAuth 2.0
- Session Management: express-session
- Rate Limiting: express-rate-limit
- Core: Vanilla JavaScript (ES6+)
- Styling: Custom CSS with glassmorphic design
- Game Libraries: p5.js, Phaser 3
- Streaming: Server-Sent Events (SSE)
- Fonts: Inter, JetBrains Mono
- Containerization: Docker, Docker Compose
- Deployment: Railway, Render, Vercel-ready
- Version Control: Git
- CI/CD: GitHub Actions ready
| Endpoint | Method | Description | Auth Required |
|---|---|---|---|
/api/generate |
POST | Generate game (standard) | No |
/api/generate-stream |
POST | Generate game (streaming) | No |
/api/chat |
POST | Chat with code assistant | No |
/api/save-game |
POST | Save game to library | Yes |
/api/my-games |
GET | Get user's saved games | Yes |
/api/games/:id |
DELETE | Delete a saved game | Yes |
/auth/google |
GET | Initiate Google OAuth | No |
/auth/logout |
GET | Log out user | Yes |
/auth/current-user |
GET | Get current user info | No |
- Limit: 3 game generations per 24 hours
- Scope: Per IP address
- Reset: Automatic after 24 hours
- Bypass: Authenticated users (future feature)
| Variable | Required | Default | Description |
|---|---|---|---|
ANTHROPIC_API_KEY |
✅ Yes | - | Your Anthropic API key |
GOOGLE_CLIENT_ID |
❌ No | - | Google OAuth client ID |
GOOGLE_CLIENT_SECRET |
❌ No | - | Google OAuth secret |
SESSION_SECRET |
✅ Yes | - | Session encryption key |
MONGODB_URI |
❌ No | local | MongoDB connection string |
PORT |
❌ No | 3000 | Server port |
- Go to railway.app
- Connect your GitHub repository
- Select the
Rayyanbranch - Add environment variables
- Deploy!
- Go to render.com
- Create a new Web Service
- Connect your repository
- Set build command:
npm install - Set start command:
node app.js - Add environment variables
- Deploy!
Deploy anywhere that supports Docker:
docker build -t games-random .
docker run -p 3000:3000 --env-file .env games-randomSee DOCKER.md for more details.
Games.Random/
├── app.js # Application entry point
├── back-end/
│ ├── server/
│ │ ├── server.js # Express server & routes
│ │ └── main.js # Claude AI integration
│ └── prompts/ # AI system prompts
├── front-end/
│ └── public/
│ ├── index.html # Main UI
│ ├── play.html # Game player
│ └── js/ # Frontend scripts
├── docker-compose.yml # Docker orchestration
├── Dockerfile # Container definition
└── .env.example # Environment template
# Install dependencies
npm install
# Start with auto-reload (using nodemon)
npm run dev
# Or start normally
npm start# Set environment to production
export NODE_ENV=production
# Start the server
npm startWe welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m "Add amazing feature" - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- Shayan Mazahir - Initial work & architecture
- Mohammad Samin - Frontend development
- Rayyan Moosani - Backend development & DevOps
- Anthropic for the amazing Claude AI API
- p5.js and Phaser communities for excellent game libraries
- All contributors and testers who helped make this project better
Have questions or need help?
- 📧 Open an Issue
- 💬 Start a Discussion
- 🐛 Report a Bug
- Support for more game libraries (Three.js, PixiJS)
- Multiplayer game generation
- Game templates and examples
- Code export and download
- Integration with GitHub for code storage
- Premium tier with unlimited generations
- Mobile app (iOS/Android)
- Game sharing and community features
Made with ❤️ and AI
⭐ Star this repo if you find it helpful!