← Back to portfolio
WebSocket
Next.js
Turborepo
Prisma
PostgreSQL
Express.js
TypeScript
TailwindCSS

2026 - Present

Draw App – Realtime Collaborative Whiteboard

Real-time collaboration is an engineering problem, not just a feature — when multiple users draw simultaneously, strokes must arrive in the right order and render without flicker. Draw App uses a persistent WebSocket server to broadcast canvas events to all connected clients instantly, with room-based session isolation so concurrent whiteboards never bleed into each other. The Turborepo monorepo splits the WebSocket server, Next.js frontend, and shared type definitions into separate packages — so a protocol change surfaces as a TypeScript error before it ever hits production.

🎨 Draw App – Realtime Collaborative Whiteboard

A realtime collaborative drawing application inspired by Excalidraw. Users can draw circles, rectangles, pencil strokes on a shared canvas and see updates instantly using WebSockets.

Built with a modern full‑stack setup: Next.js frontend, HTTP + WebSocket backend, PostgreSQL for persistence, Prisma for ORM, and Tailwind CSS for styling.


✨ Features


🏗️ Tech Stack

Frontend

Backend

Database

Tooling

<!-- ## 🧠 Data Model (Shapes) Each drawn element is stored in PostgreSQL with its type and properties. Example shape structure: ```ts { id: string; roomId: string; type: "rectangle" | "circle" | "pencil"; x: number; y: number; width?: number; height?: number; radius?: number; points?: { x: number; y: number }[]; // for pencil strokeColor: string; strokeWidth: number; createdAt: Date; } ``` -->

🔌 Realtime Architecture

  1. User joins a room

  2. Existing shapes are fetched via HTTP

  3. WebSocket connection is established

  4. Any new drawing action:

    • Broadcasted to all clients in the room
    • Persisted in PostgreSQL
  5. Other users receive and render updates instantly


🚀 Getting Started

1️⃣ Install dependencies

pnpm install

2️⃣ Setup environment variables

DATABASE_URL=postgresql://user:password@localhost:5432/drawapp

3️⃣ Run database migrations

pnpm --filter @repo/db prisma migrate dev

4️⃣ Build all packages

pnpm build

5️⃣ Start development servers

pnpm dev

🧪 Future Improvements


🙌 Inspiration

Inspired by Excalidraw, focusing on simplicity, realtime collaboration, and clean architecture.


📜 License

MIT License


Made with ❤️ using TypeScript, WebSockets, and PostgreSQL