CollabCanvas is a real-time collaborative canvas application where multiple users can create, move, and interact with rectangles simultaneously. Users can pan and zoom the canvas, see each other's cursors in real-time, and work together on the same canvas with instant synchronization. The app handles authentication, manages user presence, and resolves conflicts when multiple users edit simultaneously. Built with Vue 3, Konva.js, and Firebase.
- Frontend: Vue 3 + Vite + TypeScript
- Canvas: Konva.js + Vue-Konva
- Backend: Firebase (Firestore + Auth + Hosting)
- Styling: CSS3 with custom components
- Real-time: Firestore real-time listeners
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Vue 3 App │ │ Firestore │ │ Firebase Auth │
│ │ │ │ │ │
│ • Canvas View │◄──►│ • Rectangles │ │ • Email/Pass │
│ • Auth System │ │ • Cursors │ │ • Google OAuth │
│ • Real-time UI │ │ • Presence │ │ • User Profiles │
└─────────────────┘ └──────────────────┘ └─────────────────┘
- User Actions → Local optimistic updates → Firestore persistence
- Firestore Changes → Real-time listeners → UI updates across all clients
- Conflict Resolution → Last write wins based on server timestamps
- Node.js 18+
- npm or yarn
- Firebase account
git clone <your-repo-url>
cd collab_canvas
cd ui
npm install- Create a new Firebase project at console.firebase.google.com
- Enable Authentication (Email/Password + Google)
- Create Firestore database
- Get your Firebase config
Create ui/.env.local:
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_idnpm run devVisit http://localhost:5173 and start collaborating!
cd ui
npm run build# Install Firebase CLI (if not already installed)
npm install -g firebase-tools
# Login to Firebase
firebase login
# Deploy
firebase deploycollab_canvas/
├── ui/ # Vue 3 frontend application
│ ├── src/
│ │ ├── components/ # Reusable Vue components
│ │ │ ├── Rectangle.vue # Canvas rectangle component
│ │ │ ├── UserCursor.vue # Multiplayer cursor display
│ │ │ ├── NavBar.vue # Navigation and user info
│ │ │ ├── ErrorHandler.vue # Global error handling
│ │ │ └── ...
│ │ ├── composables/ # Vue composables (business logic)
│ │ │ ├── useAuth.js # Authentication management
│ │ │ ├── useRectangles.js # Rectangle state management
│ │ │ ├── useCursors.js # Cursor tracking
│ │ │ ├── usePresence.js # User presence awareness
│ │ │ ├── useFirestore.js # Firestore operations
│ │ │ └── ...
│ │ ├── views/ # Page components
│ │ │ ├── AuthView.vue # Login/signup page
│ │ │ └── CanvasView.vue # Main canvas workspace
│ │ └── utils/ # Utility functions
│ └── ...
├── firebase.json # Firebase configuration
├── firestore.rules # Firestore security rules
└── README.md # This file
useAuth: Handles authentication, user profiles, and sessionsuseRectangles: Manages rectangle state, creation, updates, and persistenceuseFirestore: Abstracts Firestore operations with error handling and retriesuseCursors: Tracks real-time cursor positions with throttlingusePresence: Manages user online/offline status and presence awarenessusePerformance: Monitors and optimizes app performanceuseErrorHandling: Provides comprehensive error handling and recovery
Built with Vue 3, Konva.js, and Firebase