Skip to content

Abdul-Asa/live-canvas

Repository files navigation

Virtual Space - Live Collaborative Whiteboard

A real-time collaborative whiteboard application that enables multiple users to work together seamlessly with live cursors, video/audio communication, and an infinite canvas experience.

Virtual Space Demo Next.js React TypeScript

โœจ Features

๐ŸŽจ Real-time Collaborative Canvas

  • Infinite pannable and zoomable canvas
  • Live cursor tracking with user names and colors
  • Real-time synchronization across all connected users
  • Mobile-responsive touch interactions

๐ŸŽช Interactive Elements

  • Stickers: Add fun visual elements to your canvas
  • Polaroids: Create note-like elements with custom colors
  • Drag and drop functionality for all canvas items

๐ŸŽฅ Video & Audio Integration

  • Built-in video/audio rooms using 100ms
  • Mute/unmute controls
  • Join with audio/video disabled by default
  • Real-time user presence indicators

๐Ÿ—บ๏ธ Navigation & UI

  • Minimap: Quick navigation across large canvas areas
  • Toolbar: Easy access to canvas tools and options
  • Pan Mode: Navigate the canvas efficiently
  • Online user counter
  • Responsive design for desktop and mobile

๐ŸŽจ Customization

  • Personal color picker for user identification
  • Custom usernames (up to 10 characters)
  • Modern, clean UI with dark/light themes

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn package manager

Environment Variables

Create a .env.local file in the root directory with the following variables:

NEXT_PUBLIC_LIVEBLOCKS_KEY=your_liveblocks_public_key
NEXT_PUBLIC_HMS_ROOM_ID=your_100ms_room_code

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/virtual-space.git
    cd virtual-space
  2. Install dependencies

    npm install
    # or
    yarn install
  3. Set up environment variables

  4. Start the development server

    npm run dev
    # or
    yarn dev
  5. Open your browser Navigate to http://localhost:3000

๐Ÿ› ๏ธ Tech Stack

Frontend Framework

  • Next.js 14 - React framework with App Router
  • React 18 - UI library
  • TypeScript - Type safety

Real-time Collaboration

  • Liveblocks - Real-time collaboration infrastructure
  • 100ms - Video/audio communication platform

State Management

  • Jotai - Atomic state management
  • Jotai DevTools - Development debugging

UI & Styling

  • Tailwind CSS - Utility-first CSS framework
  • Radix UI - Accessible component primitives
  • Lucide React - Icon library
  • Framer Motion - Animation library
  • React Color - Color picker component
  • Vaul - Drawer component

Development Tools

  • ESLint - Code linting
  • PostCSS - CSS processing
  • Autoprefixer - CSS vendor prefixing

๐Ÿ“ Project Structure

virtual-space/
โ”œโ”€โ”€ app/                    # Next.js App Router
โ”‚   โ”œโ”€โ”€ globals.css        # Global styles
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout
โ”‚   โ”œโ”€โ”€ page.tsx           # Home page (user setup)
โ”‚   โ””โ”€โ”€ room/              # Collaborative room
โ”‚       โ””โ”€โ”€ page.tsx       # Main whiteboard interface
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ providers/         # Context providers
โ”‚   โ”‚   โ”œโ”€โ”€ 100ms-provider.tsx    # Video/audio provider
โ”‚   โ”‚   โ”œโ”€โ”€ jotai-provider.tsx    # State management
โ”‚   โ”‚   โ””โ”€โ”€ liveblocks-room.tsx   # Real-time collaboration
โ”‚   โ”œโ”€โ”€ ui/                # Reusable UI components
โ”‚   โ””โ”€โ”€ whiteboard/        # Whiteboard-specific components
โ”‚       โ”œโ”€โ”€ canvas.tsx     # Main canvas component
โ”‚       โ”œโ”€โ”€ cursor.tsx     # User cursor display
โ”‚       โ”œโ”€โ”€ minimap.tsx    # Canvas minimap
โ”‚       โ”œโ”€โ”€ note.tsx       # Note/polaroid elements
โ”‚       โ”œโ”€โ”€ other-cursors.tsx     # Other users' cursors
โ”‚       โ””โ”€โ”€ toolbar.tsx    # Canvas toolbar
โ”œโ”€โ”€ hooks/                 # Custom React hooks
โ”œโ”€โ”€ lib/                   # Utilities and configuration
โ”‚   โ”œโ”€โ”€ constants.ts       # App constants
โ”‚   โ”œโ”€โ”€ jotai-state.ts    # Global state atoms
โ”‚   โ”œโ”€โ”€ type.ts           # TypeScript type definitions
โ”‚   โ””โ”€โ”€ utils.ts          # Utility functions
โ”œโ”€โ”€ public/               # Static assets
โ”‚   โ””โ”€โ”€ stickers/         # Sticker assets
โ””โ”€โ”€ liveblocks.config.ts  # Liveblocks configuration

๐ŸŽฎ Usage

Getting Started

  1. Enter your username (max 10 characters)
  2. Pick a unique color for your cursor
  3. Click "Join Room" to enter the collaborative space

Canvas Navigation

  • Mouse/Trackpad: Scroll to pan around the canvas
  • Touch: Use pinch and drag gestures on mobile
  • Minimap: Click to jump to different areas

Adding Elements

  • Use the toolbar to add stickers and polaroids
  • Drag elements around the canvas
  • Elements are synced in real-time with other users

Video/Audio

  • Video/audio features are automatically available
  • Users join with audio/video muted by default
  • Use 100ms controls to manage your media

โš ๏ธ Important Notes

  • Public Canvas: This is a public workspace accessible to anyone
  • No Data Persistence: Video, audio, and user data are not stored
  • Demo Project: Intended for demonstration and testing purposes
  • Security: While effort has been made to ensure security, use responsibly

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”— Links

๐Ÿ™ Acknowledgments


Built with โค๏ธ using Next.js, Liveblocks, and 100ms

About

A virtual space with multiplayer and video calling features

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors