A real-time collaborative canvas application where multiple users can create, edit, and manipulate shapes together in real-time. Built with React, TypeScript, Konva.js, and Firebase.
๐ Live Demo: https://collabcanva-d9e10.web.app
- ๐จ Interactive Canvas - 5000x5000px workspace with pan and zoom controls
- ๐ฆ Multi-Shape Support - Create, move, resize, rotate, and delete rectangles, circles, triangles, text, ellipses, stars, polygons, paths, and images
- ๐ Real-time Synchronization - Changes sync instantly across all connected users (<100ms latency)
- ๐ Object Locking - Automatic locking when users interact with shapes to prevent conflicts
- ๐ฅ User Presence - See who's online and actively working on the canvas
- ๐ฑ๏ธ Multiplayer Cursors - Track other users' cursor positions in real-time (when Realtime Database is enabled)
- ๐ฏ Multi-Select - Select multiple shapes with Cmd/Ctrl+Click or box selection
- ๐ Text Editing - Rich text formatting with font size, family, style (bold, italic, underline), and color
- ๐ผ๏ธ Image Upload - Upload and embed images directly on the canvas
- ๐จ Color Picker - Change shape colors with recent colors and saved palettes
- โฉ๏ธ Undo/Redo - Full history system with keyboard shortcuts (Cmd+Z/Cmd+Shift+Z)
- โจ๏ธ Keyboard Shortcuts - Comprehensive shortcuts for all operations
- ๐ค Export - Export canvas as PNG or SVG
- ๐ค AI Assistant - Natural language commands to create and manipulate shapes
- ๐ข Multi-Project System - Create and manage multiple projects with separate canvases
- ๐ค User Management - Profile, settings, and signout functionality
- ๐ Dark/Light Mode - Complete theme switching with proper canvas backgrounds
- ๐ง Email/Password Authentication - Secure user registration and login
- ๐พ Persistent Sessions - Stay logged in across browser sessions
- ๐ฏ Modern UI/UX - Beautiful gradient design with glassmorphism effects
- ๐ฑ Responsive Design - Works on desktop and tablet devices
- โ Help System - Interactive tutorial overlay for new users
- ๐ญ Empty State - Helpful onboarding when canvas is empty
- โก Performance - 60 FPS rendering with 500+ shapes
- ๐ Performance Monitor - Built-in FPS counter and stress testing tools
- ๐ Dark/Light Mode - Complete theme switching with proper canvas backgrounds
- ๐๏ธ Flexible Toolbar - Movable toolbar (sidebar or bottom docked)
- ๐ Alignment Tools - Align and distribute shapes
- ๐ Z-Index Management - Bring to front, send to back, layer management
- ๐ Notifications - Real-time notification system
- ๐ Search - Search projects and canvases
- ๐ค User Profile - Profile management with settings and signout
- React 18 - UI framework
- TypeScript - Type-safe development
- Vite - Lightning-fast build tool
- Tailwind CSS - Utility-first CSS framework
- Konva.js - HTML5 Canvas library for shape rendering
- React Konva - React bindings for Konva
- Firebase Authentication - User management
- Cloud Firestore - Real-time database for canvas state
- Firebase Realtime Database - High-frequency updates for cursors (optional)
- Firebase Hosting - Static site deployment
- OpenAI API - AI-powered natural language commands
- ESLint - Code linting
- PostCSS - CSS processing
- Firebase CLI - Deployment management
- Node.js 18+ and npm
- Firebase account
- Git
- Clone the repository
git clone https://github.com/Davaakhatan/collabcanva.git
cd collabcanva- Install dependencies
npm install-
Set up Firebase
- Create a new Firebase project at Firebase Console
- Enable Authentication (Email/Password only)
- Create a Firestore database
- (Optional) Create a Realtime Database for multiplayer cursors
- Copy your Firebase configuration
-
Configure environment variables
cp env.example .envEdit .env with your Firebase credentials:
VITE_FIREBASE_API_KEY=your-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_DATABASE_URL=https://your-project-default-rtdb.firebaseio.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.firebasestorage.app
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
VITE_FIREBASE_APP_ID=your-app-id
VITE_FIREBASE_MEASUREMENT_ID=your-measurement-id
VITE_OPENAI_API_KEY=your-openai-api-key.env file to version control. It's already in .gitignore for your protection.
- Run development server
npm run devOpen http://localhost:5173 in your browser.
- Build the application
npm run build- Preview the production build locally
npm run preview- Install Firebase CLI (if not already installed)
npm install -g firebase-tools- Login to Firebase
firebase login- Initialize Firebase (first time only)
firebase initSelect:
- Hosting
- Firestore
- Use existing project
- Public directory:
dist - Single-page app:
Yes
- Deploy
npm run build
firebase deployYour app will be live at: https://your-project-id.web.app
-
Sign Up / Login
- Create an account with email/password
- Sign in with your registered credentials
-
Canvas Controls
- Pan: Click and drag on empty space
- Zoom: Scroll with mouse wheel or use zoom controls
- Add Shape: Click the "Add Shape" button (+ icon)
- Move Shape: Click and drag a shape
- Resize: Click a shape to select, then drag corner handles
- Rotate: Click a shape to select, then drag rotation handle
- Delete: Select a shape and press Delete or Backspace
- Multi-Select: Hold Cmd/Ctrl and click multiple shapes, or drag to box select
- Text Editing: Double-click text shapes to edit content
- Color Change: Select shapes and use the color picker
- Upload Images: Click the upload button to add images
- Export: Click export button to download as PNG/SVG
-
AI Assistant
- Click the AI Assistant button to open the command panel
- Try commands like:
- "Create a red circle at 500, 300"
- "Make a 3x3 grid of blue squares"
- "Add a text box with 'Hello World'"
- "Create 5 green triangles in a row"
-
Keyboard Shortcuts
- Cmd+Z / Ctrl+Z: Undo
- Cmd+Shift+Z / Ctrl+Shift+Z: Redo
- Delete / Backspace: Delete selected shapes
- Arrow Keys: Move selected shapes
- Cmd+D / Ctrl+D: Duplicate selected shapes
- Esc: Deselect all shapes
- ?: Show help overlay
-
Collaboration
- Multiple users can work simultaneously
- Shapes are automatically locked when being edited
- See other users' presence in the top-right panel
collabcanvas/
โโโ src/
โ โโโ components/
โ โ โโโ Auth/ # Login & Signup components
โ โ โโโ AI/ # AI Command Panel
โ โ โโโ Canvas/ # Canvas, Shape, Controls, TextFormatting
โ โ โโโ Collaboration/ # Cursors, Presence
โ โ โโโ Layout/ # Navbar
โ โโโ contexts/
โ โ โโโ AuthContext.tsx # Authentication state
โ โ โโโ CanvasContext.tsx # Canvas state management
โ โ โโโ ThemeContext.tsx # Dark/Light mode
โ โโโ hooks/
โ โ โโโ useCanvasSync.ts # Firestore sync
โ โ โโโ useCursors.ts # Cursor tracking
โ โ โโโ useHistory.ts # Undo/Redo system
โ โ โโโ usePresence.ts # User presence
โ โโโ services/
โ โ โโโ firebase.ts # Firebase initialization
โ โ โโโ canvas.ts # Canvas CRUD operations
โ โ โโโ cursor.ts # Cursor/presence operations
โ โ โโโ ai.ts # AI command processing
โ โโโ utils/
โ โ โโโ constants.ts # App constants
โ โ โโโ helpers.ts # Utility functions
โ โ โโโ performance.ts # FPS monitoring
โ โโโ App.tsx # Main app component
โ โโโ main.tsx # Entry point
โโโ public/ # Static assets
โโโ firebase.json # Firebase configuration
โโโ firestore.rules # Firestore security rules
โโโ firestore.indexes.json # Firestore indexes
โโโ .env # Environment variables (not in git)
- Environment Variables - API keys stored in
.envfile (not committed to git) - Firestore Rules - Database access controlled by authentication
- Authentication - Firebase Authentication with secure session management
- HTTPS - All traffic encrypted via Firebase Hosting
โ
Basic canvas with pan/zoom - 5000x5000px bounded canvas
โ
Multiple shape types - Rectangles, circles, triangles, text, ellipses, stars, polygons, paths, images
โ
Object locking - Automatic locking during interactions
โ
Real-time sync - <100ms shape synchronization via Firestore
โ
Multiplayer cursors - Real-time cursor tracking (optional RTDB)
โ
Presence awareness - See online users
โ
User authentication - Email/Password authentication
โ
Performance - 60 FPS with 500+ shapes
โ
Deployed - Live on Firebase Hosting
โ
Multi-select - Select and manipulate multiple shapes
โ
Undo/Redo - Full history system with keyboard shortcuts
โ
Export functionality - PNG and SVG export
โ
AI Assistant - Natural language commands
โ
Image upload - Upload and embed images
โ
Text formatting - Rich text editing with fonts and styles
โ
Color picker - Change shape colors
โ
Keyboard shortcuts - Comprehensive shortcut system
โ
Dark/Light mode - Complete theme switching with proper canvas backgrounds
โ
Alignment tools - Align and distribute shapes
โ
Z-index management - Layer management
โ
Multi-Project System - Create and manage multiple projects
โ
User Management - Profile, settings, and signout functionality
โ
Notifications - Real-time notification system
โ
Search - Search projects and canvases
- 60 FPS rendering during all interactions
- <100ms shape change synchronization
- <50ms cursor position updates (when Realtime Database enabled)
- 500+ shapes supported without FPS drops
- 5+ concurrent users tested successfully
- Advanced shape editing (bezier curves, custom paths)
- Shape grouping and ungrouping
- Layer management panel
- Custom shape libraries
- Animation and transitions
- Touch/mobile optimizations
- Voice chat integration
- Advanced AI features (auto-layout, design suggestions)
- Plugin system for custom tools
- Version history and branching
- Collaborative comments and annotations
- Multiplayer cursors require Realtime Database to be manually created in Firebase Console
- Mobile touch gestures need optimization
- Some complex multi-select operations may have minor performance impacts with 100+ shapes
This project is built as an assessment project for educational purposes.
- React - Facebook Open Source
- Konva.js - Anton Lavrenov
- Firebase - Google
- Tailwind CSS - Tailwind Labs
Built with โค๏ธ by Davaakhatan
Live Demo: https://collabcanva-d9e10.web.app
Repository: https://github.com/Davaakhatan/collabcanva
For questions or issues, please open an issue on GitHub or contact the developer.
Last Updated: January 2025
- โ Fixed Profile Dropdown - Sign out functionality now works correctly across all pages
- โ Removed Legacy Canvas Button - Cleaned up home page interface
- โ Fixed Project Counters - Active Projects and Canvases Created now show real data instead of static zeros
- โ Improved User Experience - Dynamic messages based on actual project/canvas counts