Everyone's Canvas is a real-time, collaborative drawing web application where users from around the world can draw, doodle, and share ideas on a shared, finite canvas. Built with Node.js, Express, and Fabric.js, this project offers a simple yet powerful platform for creative collaboration—no registration required!
- Collaborative Drawing: Draw, erase, and edit on a shared canvas with others in real-time.
- Finite Canvas: Work within a fixed 854x480 pixel space for a focused experience.
- Drawing Tools: Includes pencil, spray, eraser, undo/redo, and selection tools.
- Customizable Brushes: Adjust brush width for drawing, erasing, and spraying.
- Save & Load: Persist canvas state to the server and load it on startup.
- Responsive Design: Built with Bootstrap for a clean, mobile-friendly interface.
- No Sign-Up Needed: Jump right in and start drawing!
Follow these steps to set up "Everyone's Canvas" locally:
-
Clone the Repository:
git clone https://github.com/ikwbb/everyones-canvas.git cd everyones-canvas -
Install Dependencies:
npm install
-
Start the Server:
npm start
The app will run on
http://localhost:8080. -
(Optional) Development Mode: Use
nodemonfor automatic server restarts during development:npm install -g nodemon npm run dev
- Open your browser and navigate to
http://localhost:8080. - Use the toolbar to:
- Select: Move or adjust objects.
- Draw: Freehand drawing with a pencil brush.
- Spray: Spray paint effect.
- Erase: Remove parts of the drawing (toggle "Erase by stroke" for precision).
- Undo/Redo: Step back or forward through your actions.
- Adjust brush widths via sliders in the collapsible options.
- Click Save to store the canvas state on the server.
- Refresh the page to load the latest saved canvas.
everyones-canvas/
├── /client-side/ # Client-side assets
│ ├── index.html # Main HTML file
│ ├── script.js # Fabric.js logic for canvas interaction
│ └── style.css # Custom styles (optional, create if needed)
├── /data/ # Persistent data storage
│ └── canvas-data.json # Saved canvas state
├── /server/ # Backend server code
│ └── server.js # Express server
├── .gitignore # Files to ignore in Git
├── package.json # Project metadata and dependencies
├── package-lock.json # Dependency lock file
└── README.md # This file
- Backend:
- Frontend:
- Bootstrap 5: Responsive UI framework.
- Fabric.js: Client-side canvas rendering.
Run npm install to install all dependencies listed in package.json.
| Endpoint | Method | Description | Request Body | Response |
|---|---|---|---|---|
/save-data |
POST | Saves canvas data to the server | { "canvas": <FabricJSON> } |
{ "message": "..." } |
/load-data |
GET | Retrieves saved canvas data | None | <FabricJSON> |
/render-img |
GET | Renders canvas as a PNG image | None | PNG image stream |
/ |
GET | Serves the main HTML page | None | index.html |
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Make your changes and commit (
git commit -m "Add your feature"). - Push to your branch (
git push origin feature/your-feature). - Open a Pull Request.
Please ensure your code follows the existing style and includes appropriate comments.
- Add WebSocket support for real-time collaboration.
- Implement user sessions or rooms for multiple canvases.
- Enhance security with authentication and input validation.
- Add color pickers and more drawing tools.
Have questions or suggestions? Feel free to open an issue!
Happy drawing! 🎨
