A real-time multiplayer drawing and guessing game backend built with Node.js, Express, and Socket.IO.
Minimal Sketch is an online pictionary game where players take turns drawing and guessing words. The backend provides real-time communication, game state management, and room-based multiplayer functionality.
- Real-time multiplayer support using Socket.IO
- Room-based gameplay
- Turn-based drawing and guessing
- Real-time chat functionality
- Canvas synchronization
- Player management (join/leave)
- Game state management
- Socket.IO Admin UI for monitoring
- Node.js
- Express.js
- Socket.IO
- Sequelize (Database ORM)
- SQLite3 (Database)
- CORS support
- Environment-based configuration
- Socket.IO Admin UI for development
src/
├── app.js # Express application setup
├── server.js # HTTP and Socket.IO server setup
├── socketHandlers.js # Game logic and socket event handlers
├── configs/ # Configuration files
├── constants/ # Constants and enums
├── data/ # Data files (e.g., word database)
├── database/ # Database configuration
├── models/ # Database models
├── services/ # Business logic services
└── sockets/ # Socket-related utilities
- Node.js (v14 or higher)
- npm or yarn
- SQLite3 (included in dependencies)
-
Clone the repository:
git clone https://github.com/Vibhishan/minimal-sketch-backend.git cd minimal-sketch-backend -
Install dependencies:
npm install
-
Create a
.envfile in the root directory with the following variables:PORT=4000 NODE_ENV=development -
Start the development server:
npm run dev
The server will start with nodemon for automatic reloading during development.
-
Access Socket.IO Admin UI:
- Open your browser and navigate to
http://localhost:4000/admin - This provides a visual interface to monitor and debug socket connections
- Open your browser and navigate to
The project uses the following development tools:
nodemonfor automatic server reloading during development@socket.io/admin-uifor monitoring socket connections
npm run dev- Start the development server with hot reloadingnpm test- (To be implemented) Run test suite
GET /health- Health check endpoint
The backend supports various socket events for real-time communication:
-
Room Management:
CREATE_ROOMJOIN_ROOMLEAVE_ROOMROOM_STATE_UPDATE
-
Game Flow:
START_GAMEROUND_STARTTURN_STARTTURN_ENDGAME_END
-
Drawing & Guessing:
DRAW_EVENTCLEAR_CANVASWORD_SELECTEDGUESS_WORDWORD_GUESSED
-
Chat:
SEND_MESSAGERECEIVE_MESSAGE
- Word selection system
- Basic scoring mechanism
- Health check endpoint
- Round-based gameplay with multiple rounds per game
- Final scores display at game end
- Player ranking system with leaderboards
- Custom word suggestions from players
- Different game modes (e.g., speed drawing, team play)
- Power-ups and special abilities
- More drawing tools (brush, spray, shapes)
- Undo/Redo functionality
- Background color selection
- Save and share drawings
- Drawing templates or stencils
- Layer support for complex drawings
- Player profiles and avatars
- Friend system and private rooms
- Emoji reactions to drawings
- Voice chat integration
- Spectator mode
- Replay system for past games
- Responsive design for all screen sizes
- Offline mode with local storage
- Performance optimizations for large rooms
- Better error handling and recovery
- Analytics and game statistics
- Dark mode support
- Screen reader support
- Keyboard shortcuts
- High contrast mode
- Colorblind-friendly palette
- Adjustable font sizes
- Reduced motion options
- Report system for inappropriate content
- Word filtering and moderation
- Room password protection
- Anti-cheat measures
- User verification system
- Automated content moderation
Contributions are welcome! Please feel free to submit a Pull Request. Here's how you can contribute:
- 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
Please make sure to:
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Keep your PR focused on a single feature or bug fix