A full-stack Skribbl.io clone developed as a learning project, demonstrating real-time communication using WebSockets (Socket.IO) with a Flutter frontend and a Node.js/Express/Mongoose backend. This project replicates the core mechanics of the popular word-guessing drawing game.
This project is a functional clone of the popular online game Skribbl.io, where players draw and guess words in real-time. It was developed as a hands-on learning experience in full-stack application development, focusing on integrating a Flutter client with a Node.js backend using WebSockets for real-time interactions. The application showcases how to build interactive, multi-user experiences from scratch.
- Real-time Drawing: Players can draw on a shared canvas in real-time.
- Word Guessing: Players can guess the hidden word.
- Score Tracking: Basic scoring for correct guesses.
- Room-based Gameplay: Support for multiple game rooms.
- Player List: Displays active players in a room.
- Chat System: In-game chat for communication.
This project leverages a modern full-stack architecture:
Frontend:
- Flutter: UI framework for cross-platform mobile, web, and desktop applications.
- Dart: Programming language for Flutter.
socket_io_client: Dart package for WebSocket communication with Socket.IO servers.
Backend:
- Node.js: JavaScript runtime for server-side logic.
- Express.js: Web framework for Node.js, used for API routing.
- Socket.IO: Real-time bidirectional event-based communication library.
- Mongoose: ODM (Object Data Modeling) for MongoDB, used for database interactions.
- MongoDB: NoSQL database for storing game data.
Other:
axios(NPM): Promise-based HTTP client for the browser and node.js.http(NPM): Node.js built-in HTTP module.
Before setting up the project, ensure you have the following installed:
- Node.js & npm:
- Download Node.js (includes npm)
- Flutter SDK:
- MongoDB:
- Install MongoDB (or use a cloud-hosted service like MongoDB Atlas)
Follow these steps to get the Skribbl Clone up and running on your local machine.
- Navigate to the server directory:
cd server - Install Node.js dependencies:
npm install
- Important Note on Socket.IO Version: There is a known compatibility issue between
socket_io_client(Dart) and newer versions ofsocket.io(Node.js). You might need to downgradesocket.ioto version2.3.0for the project to function correctly. If you encounter issues, run:npm uninstall socket.io npm install socket.io@2.3.0
- Important Note on Socket.IO Version: There is a known compatibility issue between
- Start the server:
The server will typically run on
npm start
http://localhost:3000.
- Navigate back to the project root and then to the Flutter project directory:
cd .. # if you are in the server directory # You should be in the root directory where pubspec.yaml is located
- Get Flutter dependencies:
flutter pub get
- Run the Flutter application:
Ensure your server is running (
npm startin theserverdirectory) before launching the Flutter app.Choose your preferred device (e.g., Chrome for web, an Android emulator, or iOS simulator).flutter run
Once both the backend server and the Flutter frontend are running:
- Launch the Flutter application.
- The app will connect to your local server (defaulting to
http://localhost:3000). - You can then create a new game room or join an existing one.
- Invite friends to join the same room to start playing!
The repository is divided into two main parts:
server/: Contains the Node.js backend application.- Handles API requests, WebSocket connections, and database interactions.
lib/: Contains the Dart/Flutter frontend application.- Manages the user interface, drawing canvas, and real-time communication with the backend.
Other standard Flutter directories like android/, ios/, web/, etc., are also present for platform-specific builds.