A production-ready collaborative whiteboard application with real-time drawing, AI-powered shape generation, and enterprise-grade infrastructure
Live Demo β’ Features β’ Architecture β’ Installation
SKETCHLY-APP.webm
Sketchly is a production-ready collaborative whiteboard application inspired by Excalidraw and Tldraw, built with modern web technologies and enterprise-grade architecture. It enables teams to draw, sketch, and brainstorm together in real-time with AI-powered assistance.
π Project Status: COMPLETED - This project is fully functional and deployed to production!
- π§ Brainstorming Sessions - Collaborate with your team in real-time
- π Visual Planning - Create diagrams and flowcharts effortlessly
- π₯ Remote Collaboration - Work together from anywhere in the world
- π Online Teaching - Interactive whiteboard for educators
- π¨ Creative Ideation - Sketch ideas with AI assistance
- βοΈ Advanced Drawing Tools - Freehand pen, shapes (rectangles, circles, lines, arrows)
- π¨ Rich Color Palette - Comprehensive color picker with custom colors
- π Zoom Controls - Precise zoom in/out for detailed work
- π Shape Tools - Pre-built geometric shapes and connectors
- β‘ Live Multi-user Editing - See changes from other users instantly
- π WebSocket Integration - Dedicated WebSocket server for real-time sync
- π₯ Authenticated Collaboration - Only signed-in users can collaborate
- π Optimized Performance - Redis caching for lightning-fast updates
- π€ AI Shape Generation - LangChain integration for intelligent shape creation
- π― Natural Language Processing - Draw shapes using text descriptions
- π§ Smart Suggestions - AI-assisted drawing recommendations
- π Better Auth Integration - Modern, secure authentication system
- π§ Email/Password Authentication - Traditional login method
- π OAuth Support - Google and GitHub single sign-on
- π‘οΈ Session Management - Secure user sessions with automatic refresh
- πΎ PostgreSQL Database - Production-grade relational database
- π Prisma ORM - Type-safe database queries and migrations
- β‘ Redis Caching - Fast data retrieval and real-time sync
- π Automatic Saving - All drawings saved automatically
- π± Responsive Design - Seamless experience across all devices
- π― Server Actions - Next.js server actions instead of traditional HTTP endpoints
- ποΈ Monorepo Structure - Turborepo for efficient code organization
- π¨ ShadCN/UI Components - Beautiful, accessible UI library
- π³ Docker Support - Complete containerization with Docker Compose
- π CI/CD Pipeline - Automated testing and deployment
- π¦ Docker Hub Integration - Automated image builds and publishing
- βοΈ Vercel Deployment - Production deployment on Vercel
- π Zero-Downtime Deploys - Continuous deployment with rollback support
Sketchly/
βββ apps/
β βββ web/ # Next.js Frontend Application
β β βββ src/
β β β βββ app/ # Next.js App Router
β β β βββ components/ # React Components (ShadCN/UI)
β β β βββ lib/ # Utilities & Helpers
β β β βββ actions/ # Server Actions
β βββββββ Dockerfiles
β β
β βββ websocket/ # WebSocket Server Layer
β βββ src/
β β βββ handlers/ # WebSocket event handlers
β β βββ redis/ # Redis client configuration
β β βββ db/ # Database integration
β
βββ packages/
β βββ database/ # Prisma ORM Package
β β βββ prisma/
β β β βββ schema.prisma # Database schema
β β β βββ migrations/ # Database migrations
β β βββ src/ # Prisma client exports
β β
β βββ ui/ # Shared UI Components (ShadCN)
β β βββ components/ # Reusable components
β β
β βββ typescript-config/ # Shared TypeScript configs
β βββ eslint-config/ # Shared ESLint configs
β
βββ .github/
β βββ workflows/ # CI/CD Pipeline
β βββ build.yml # Build and test
β βββ deploy.yml # Deploy to Vercel
β βββ docker.yml # Build and push Docker images
β
βββ docker-compose.yml # Multi-container orchestration
βββ turbo.json # Turborepo configuration
βββ pnpm-workspace.yaml # pnpm workspace setup
βββ README.md
- Next.js 15 - React framework with App Router
- TypeScript - Type-safe development
- TailwindCSS - Utility-first styling
- ShadCN/UI - Beautiful component library
- React - UI rendering library
- Server Actions - Type-safe server mutations
- WebSocket - Real-time bidirectional communication
- Node.js - JavaScript runtime
- Redis - In-memory data store for caching
- PostgreSQL 15+ - Production database
- Prisma ORM - Type-safe database client
- Redis - Caching and real-time data sync
- LangChain - AI orchestration framework
- LLM Integration - Natural language shape generation
- Better Auth - Modern authentication solution
- OAuth Providers - Google, GitHub integration
- Email/Password - Traditional authentication
- Docker - Containerization platform
- Docker Compose - Multi-container orchestration
- GitHub Actions - CI/CD automation
- Vercel - Frontend deployment platform
- Docker Hub - Container registry
Ensure you have the following installed:
- Node.js (v18 or higher)
- pnpm (v8 or higher)
- Docker and Docker Compose
- Git
The fastest way to get Sketchly running locally:
git clone https://github.com/Tejas-pr/Sketchly.git
cd SketchlyCreate a .env file in the root directory:
# Database
DATABASE_URL="postgresql://postgres:postgres@postgres:5432/sketchly?schema=public"
# Redis
REDIS_URL="redis://redis:6379"
# Authentication (Better Auth)
BETTER_AUTH_SECRET="your-secret-key-here-min-32-chars"
BETTER_AUTH_URL="http://localhost:3000"
# OAuth Providers
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
GITHUB_CLIENT_ID="your-github-client-id"
GITHUB_CLIENT_SECRET="your-github-client-secret"
# AI / LangChain
GOOGLE_API_KEY="your-openai-api-key" # Optional: For AI features
# Environment
NODE_ENV="development"# Build and start all containers
docker-compose up --build
# Or run in detached mode
docker-compose up -dThis single command starts:
- β PostgreSQL database
- β Redis cache
- β Next.js web application
- β WebSocket server
- Web App: http://localhost:3000
- WebSocket: ws://localhost:8080
- Database:
localhost:5432 - Redis:
localhost:6379
If you prefer to run services individually:
pnpm install# Start PostgreSQL
docker run -d \
--name sketchly-postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=sketchly \
-p 5432:5432 \
postgres:15
# Start Redis
docker run -d \
--name sketchly-redis \
-p 6379:6379 \
redis:7-alpinepnpm --filter=database prisma:generate
pnpm --filter=database prisma:migrate# Start all apps (web + websocket)
pnpm dev
# Or start individually
pnpm dev --filter=web # Web app on :3000
pnpm dev --filter=websocket # WebSocket on :8080# Start all services
docker-compose up
# Start in background
docker-compose up -d
# Stop all services
docker-compose down
# Stop and remove volumes (deletes data)
docker-compose down -v
# View logs
docker-compose logs -f
# View logs for specific service
docker-compose logs -f web
docker-compose logs -f websocket
# Rebuild containers
docker-compose build
# Restart a specific service
docker-compose restart web# List running containers
docker ps
# Stop a container
docker stop sketchly-postgres
docker stop sketchly-redis
# Start a stopped container
docker start sketchly-postgres
# View container logs
docker logs sketchly-postgres -f
# Access container shell
docker exec -it sketchly-postgres psql -U postgres -d sketchly
docker exec -it sketchly-redis redis-cli
# Remove containers
docker rm -f sketchly-postgres sketchly-redis# Development - runs all apps
pnpm dev
# Build all apps
pnpm build
# Production start
pnpm start
# Lint all code
pnpm lint
# Format code
pnpm format
# Run tests
pnpm test
# Clean build artifacts
pnpm clean# Web app only
pnpm dev --filter=web
pnpm build --filter=web
# WebSocket server only
pnpm dev --filter=websocket
pnpm build --filter=websocket
# Database commands
pnpm --filter=database prisma:generate
pnpm --filter=database prisma:migrate
pnpm --filter=database prisma:studio
pnpm --filter=database prisma:seed# Build web app image
docker build -t sketchly-web ./apps/web
# Build websocket image
docker build -t sketchly-websocket ./apps/websocket
# Build all with docker-compose
docker-compose buildSketchly uses GitHub Actions for automated CI/CD:
- Build & Test (
.github/workflows/web.yml)- Runs on every push and PR
- Installs dependencies with pnpm
- Runs linting and type checking
- Builds all apps and packages
- Runs test suites
Pre-built images are available on Docker Hub:
# Pull latest images
docker pull tejaspr/sketchly-web:latest
# Run from Docker Hub
docker run -p 3000:3000 tejaspr/sketchly-web:latest- Select a Tool - Choose from pen, shapes, or text tools
- Pick a Color - Use the color picker to customize
- Draw on Canvas - Click and drag to create
- Pan & Zoom - Use mouse wheel to zoom, drag to pan
- Sign In - Authenticate with email, Google, or GitHub
- Share Canvas - Share the URL with collaborators
- Collaborate - See real-time updates from other users
- Auto-save - All changes saved automatically
- Activate AI Tool - Click the AI assistant button
- Describe Shape - Type natural language description
- Example: "Create a flowchart with 3 connected boxes"
- Example: "Draw a circle connected to a square with an arrow"
- Generate - AI creates shapes based on your description
- Refine - Adjust and customize the generated shapes
Better Auth is configured in apps/web/lib/auth.ts. The system supports:
- Email/Password - Traditional authentication
- Google OAuth - Single sign-on with Google
- GitHub OAuth - Single sign-on with GitHub
- Visit Google Cloud Console
- Create a new project
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs:
- Development:
http://localhost:3000/api/auth/callback/google - Production:
https://yourdomain.com/api/auth/callback/google
- Development:
- Copy credentials to
.env:GOOGLE_CLIENT_ID="your-client-id" GOOGLE_CLIENT_SECRET="your-client-secret"
- Go to GitHub Developer Settings
- Create a new OAuth App
- Set Authorization callback URL:
- Development:
http://localhost:3000/api/auth/callback/github - Production:
https://yourdomain.com/api/auth/callback/github
- Development:
- Copy credentials to
.env:GITHUB_CLIENT_ID="your-client-id" GITHUB_CLIENT_SECRET="your-client-secret"
# Generate Prisma Client
pnpm --filter=database prisma:generate
# Create a new migration
pnpm --filter=database prisma:migrate dev --name your_migration_name
# Apply migrations to production
pnpm --filter=database prisma:migrate deploy
# Open Prisma Studio (Database GUI)
pnpm --filter=database prisma:studio
# Reset database (caution: deletes all data)
pnpm --filter=database prisma:migrate reset
# Seed database
pnpm --filter=database prisma:seedKey models in the Prisma schema:
- User - User accounts and profiles
- Session - User sessions for Better Auth
- Canvas - Whiteboard canvases
- Shape - Individual drawing elements
- Collaboration - Real-time collaboration sessions
Redis is used in the WebSocket layer to:
- Cache active canvas data for fast access
- Store real-time collaboration state
- Queue shape updates before database write
- Manage WebSocket connection states
The web application is automatically deployed to Vercel via GitHub Actions:
- Push to main branch β Triggers deployment
- Automatic build β Next.js builds and optimizes
- Database migrations β Prisma migrations applied
- Live deployment β Available at production URL
Live Demo: https://sketchly.vercel.app
# Production deployment
docker-compose -f docker-compose.prod.yml up -d
# Scale services
docker-compose up -d --scale websocket=3# Pull from Docker Hub
docker pull tejaspr/sketchly-web:latest
docker pull tejaspr/sketchly-websocket:latest
# Run containers
docker run -d \
--name sketchly-web \
-p 3000:3000 \
--env-file .env.production \
tejaspr/sketchly-web:latest
docker run -d \
--name sketchly-websocket \
-p 8080:8080 \
--env-file .env.production \
tejaspr/sketchly-websocket:latest# Database (Production)
DATABASE_URL="your-production-database-url"
# Redis (Production)
REDIS_URL="your-production-redis-url"
# Authentication
BETTER_AUTH_SECRET="secure-random-string-min-32-chars"
BETTER_AUTH_URL="https://yourdomain.com"
# OAuth
GOOGLE_CLIENT_ID="production-google-client-id"
GOOGLE_CLIENT_SECRET="production-google-client-secret"
GITHUB_CLIENT_ID="production-github-client-id"
GITHUB_CLIENT_SECRET="production-github-client-secret"
# AI (Optional)
OPENAI_API_KEY="your-openai-api-key"
# Environment
NODE_ENV="production"Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Follow existing code style
- Add tests for new features
- Update documentation
- Commit your changes
git commit -m 'feat: add amazing feature' - Push to your fork
git push origin feature/amazing-feature
- Open a Pull Request
- Code Style: Follow the existing TypeScript/React patterns
- Commits: Use conventional commits (feat, fix, docs, etc.)
- Testing: Add tests for new functionality
- Documentation: Update README and inline docs
- Type Safety: Maintain strict TypeScript types
- π¨ UI/UX improvements
- π Bug fixes
- β¨ New features (shapes, tools, export options)
- π Documentation improvements
- π§ͺ Test coverage
- π Internationalization
- βΏ Accessibility enhancements
Found a bug or have an idea? Please open an issue!
For bugs, include:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Screenshots/videos if applicable
- Environment (browser, OS, etc.)
For features, include:
- Clear description of the feature
- Use cases and benefits
- Proposed implementation (optional)
- UI mockups (optional)
- Turborepo Docs - Monorepo management
- Next.js Docs - React framework
- Prisma Docs - Database ORM
- Better Auth Docs - Authentication
- ShadCN/UI - UI components
- LangChain Docs - AI integration
- Docker Docs - Containerization
- pnpm Workspaces - Package management
- GitHub Repository - Source code
- Issues - Bug reports
- Discussions - Community forum
- Docker Hub - Container images
- Redis Caching - Fast data retrieval and reduced database load
- WebSocket Optimization - Efficient real-time communication
- Server Actions - Type-safe mutations without HTTP overhead
- Turborepo Caching - Fast builds with intelligent caching
- Docker Compose - Easy horizontal scaling
Recommended monitoring tools:
- Vercel Analytics - Frontend performance
- Database Monitoring - Query performance
- Redis Insights - Cache hit rates
- WebSocket Metrics - Connection health
Security is a top priority for Sketchly:
- β Better Auth - Modern, secure authentication
- β OAuth 2.0 - Industry-standard authorization
- β CSRF Protection - Cross-site request forgery prevention
- β SQL Injection Prevention - Prisma's parameterized queries
- β Environment Variables - Sensitive data protection
- β Rate Limiting - API abuse prevention
- β Input Validation - Server-side validation
Reporting Security Issues: Please email security concerns privately to the maintainer.
This project is licensed under the MIT License - see the LICENSE file for details.
Tejas
- GitHub: @Tejas-pr
- Portfolio: tejaspr.site
Special thanks to:
- Excalidraw for inspiration
- Vercel for hosting
- Turborepo team for amazing monorepo tools
- ShadCN for beautiful UI components
- All contributors and supporters
If you find Sketchly helpful, please:
- β Star this repository
- π Report bugs
- π‘ Suggest features
- π€ Contribute code
- π’ Share with others
Have questions or suggestions?
- π Open an issue
- π¬ Start a discussion
- Status: β Production Ready
- Latest Version: v1.0.0
- Stars: β Give us a star!
Built with β€οΈ using Next.js, Turborepo, and modern web technologies
Made by Tejas