A real-time collaborative whiteboard application built with React, Node.js, and PostgreSQL. This webapp allows users to create, share, and collaborate on digital whiteboards with drawing tools, real-time synchronization, and user management.
- User Authentication: Secure login/signup with JWT tokens and bcrypt password hashing
- Whiteboard Creation: Create and manage multiple whiteboards
- Drawing Tools: Pen, line, square, circle, and eraser tools
- Real-time Collaboration: Multiple users can draw simultaneously on the same board
- History Management: Undo/redo functionality with canvas state history
- Board Management: Create, view, update, and delete whiteboards
- Responsive Design: Works on desktop and mobile devices
- Multiple Drawing Tools: Pen, line, square, circle, and eraser
- Touch Support: Full touch support for mobile devices
- High DPI Support: Optimized for high-resolution displays
- Canvas Operations: Clear canvas, undo/redo, real-time preview
- Event Tracking: All drawing events are tracked and stored for collaboration
client/
βββ src/
β βββ components/ # Reusable UI components
β β βββ Canvas.jsx # Main drawing canvas component
β β βββ ActionBar.jsx # Tool selection and actions
β β βββ BoardCard.jsx # Individual board display
β β βββ Header.jsx # Navigation header
β β βββ ...
β βββ pages/ # Route components
β β βββ Dashboard.jsx # Main dashboard
β β βββ Board.jsx # Whiteboard interface
β β βββ Login.jsx # Authentication page
β β βββ Hero.jsx # Landing page
β βββ context/ # React context for state management
β β βββ UserContext.jsx # User authentication context
β βββ helper.js # API configuration
server/
βββ controllers/ # Business logic controllers
β βββ userController.js # User authentication logic
β βββ boardController.js # Board management logic
βββ middlewares/ # Custom middleware
β βββ tokenVerify.js # JWT authentication middleware
βββ routes/ # API route definitions
β βββ userRoute.js # User-related endpoints
β βββ boardRoute.js # Board-related endpoints
βββ prisma/ # Database schema and migrations
β βββ schema.prisma # Database schema definition
βββ index.js # Main server file
The application uses PostgreSQL with Prisma ORM for database management.
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
password_hash String
createdAt DateTime @default(now())
isAuthenticated Boolean @default(false)
boards Board[]
events Event[]
}model Board {
id Int @id @default(autoincrement())
title String
content String
authorId Int
author User @relation(fields: [authorId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
events Event[]
}model Event {
id Int @id @default(autoincrement())
board_id Int
user_id Int
event_type String
event_data Json
createdAt DateTime @default(now())
board Board @relation(fields: [board_id], references: [id])
user User @relation(fields: [user_id], references: [id])
}- React 19.1.1 - UI library
- Vite - Build tool and development server
- React Router DOM - Client-side routing
- Tailwind CSS - Utility-first CSS framework
- Axios - HTTP client for API calls
- React Toastify - Toast notifications
- Node.js - Runtime environment
- Express.js - Web framework
- Prisma - Database ORM
- PostgreSQL - Database
- JWT - Authentication tokens
- bcryptjs - Password hashing
- Socket.io - Real-time communication (configured but not fully implemented)
- CORS - Cross-origin resource sharing
- Node.js (v16 or higher)
- PostgreSQL database
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd WhiteBoard
-
Install dependencies
# Install server dependencies cd server npm install # Install client dependencies cd ../client npm install
-
Database Setup
# Create a PostgreSQL database # Update the DATABASE_URL in server/.env # Run database migrations cd server npx prisma migrate dev npx prisma generate
-
Environment Variables
Create
server/.envfile:DATABASE_URL="postgresql://username:password@localhost:5432/whiteboard_db" JWT_SECRET="your-jwt-secret-key" NODE_ENV="development"
Create
client/.envfile:VITE_BACKEND_URL="http://localhost:7000"
-
Start the application
# Start the backend server cd server npm run dev # Start the frontend development server (in a new terminal) cd client npm run dev
-
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:7000
- Registration: Create new user accounts with email and password
- Authentication: Secure login with JWT token-based authentication
- Session Management: Persistent login sessions with HTTP-only cookies
- User Profile: View and manage user information
- Create Boards: Create new whiteboards with custom titles and descriptions
- Board Dashboard: View all user's whiteboards in an organized dashboard
- Board Operations: Edit, delete, and manage whiteboard properties
- Board Access: Navigate to individual whiteboards via unique URLs
- Drawing Tools:
- Pen: Freehand drawing with customizable stroke
- Line: Straight line drawing with preview
- Square: Rectangle drawing with live preview
- Circle: Circular shapes with radius preview
- Eraser: Remove parts of the drawing
- Canvas Operations:
- Undo/Redo: Step-by-step history navigation
- Clear Canvas: Reset the entire whiteboard
- Real-time Preview: Live preview for shape tools
- Touch Support: Full mobile and tablet support
- Event System: All drawing events are tracked and stored
- Socket.io Integration: Real-time communication infrastructure
- Event Synchronization: Drawing events are saved to database for persistence
- Multi-user Support: Multiple users can collaborate on the same board
POST /api/users/signup- User registrationPOST /api/users/login- User loginPOST /api/users/logout- User logoutGET /api/users/getuserdata- Get user details
GET /api/boards/getboards- Get all user boardsGET /api/boards/:boardId- Get specific boardPOST /api/boards/create- Create new boardPUT /api/boards/update/:boardId- Update boardDELETE /api/boards/delete/:boardId- Delete board
POST /api/boards/:boardId/event- Save drawing eventGET /api/boards/:boardId/events- Get board eventsDELETE /api/boards/:boardId/events- Clear board events
- Dark Theme: Modern dark interface with gradient backgrounds
- Responsive Layout: Mobile-first responsive design
- Interactive Elements: Hover effects and smooth transitions
- Toast Notifications: User feedback for all actions
- Loading States: Visual feedback during API calls
- Intuitive Navigation: Clear navigation between boards and dashboard
- Tool Selection: Easy-to-use drawing tool selection
- Visual Feedback: Real-time preview for drawing tools
- Error Handling: Comprehensive error messages and validation
- Password Hashing: bcrypt for secure password storage
- JWT Authentication: Secure token-based authentication
- HTTP-Only Cookies: Secure cookie storage for tokens
- CORS Protection: Configured cross-origin resource sharing
- Input Validation: Server-side validation for all inputs
- Protected Routes: Authentication middleware for secure endpoints
- Board Sharing: Share boards with specific users or make them public
- Export Functionality: Export boards as images or PDFs
- Advanced Drawing Tools: More drawing tools and customization options
- Board Templates: Pre-designed board templates
- Comments and Annotations: Add text comments to boards
- Version History: Track and restore previous versions of boards
- Performance Optimization: Canvas rendering optimizations
- Offline Support: Progressive Web App features
- Mobile App: React Native mobile application
- Advanced Caching: Redis for improved performance
- File Uploads: Support for image and document uploads
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- React team for the amazing framework
- Prisma team for the excellent ORM
- Tailwind CSS for the utility-first CSS framework
- All contributors and users of this project