← Back to Projects

CoSketch — Real-Time Collaborative Whiteboard with OpenRouter AI

CoSketch — Real-Time Collaborative Whiteboard with OpenRouter AI

CoSketch is a high-performance, real-time collaborative digital whiteboard engineered for seamless team brainstorming and AI-assisted ideation. Powered by React 19, Node.js (Express 5), Neon Serverless PostgreSQL, and Socket.IO, CoSketch features multi-user live cursor synchronization, infinite canvas sketching, and direct OpenRouter AI integration (OpenAI-compatible chat completions with structured JSON schema) to brainstorm sticky notes, construct flow diagrams, generate interactive charts (bar, line, pie, donut), edit selections in-place, and synthesize board summaries into structured executive themes and action items.

Main Technology Stack

React 19Node.jsExpress 5Socket.IOOpenRouter APINeon PostgreSQLNeon Auth (JWT)Neon Object StorageTailwind CSSFramer MotionVite

Key Contributions

  • Engineered real-time canvas synchronization via Socket.IO room architectures (wb:join, element:live, presence:cursor), streaming low-latency live cursor movements and multi-user shape modifications with optimistic UI rendering.
  • Integrated OpenRouter API using native fetch with structured json_schema response formats for deterministic AI outputs (brainstorming sticky notes, structured outlines/agendas, flow diagrams, interactive charts with live spreadsheet editing, in-place selection editing, and executive board summaries).
  • Constructed a secure, multi-tenant permission engine on Neon Serverless PostgreSQL with per-board granular role checks (Owner, Editor, Viewer) verified on every REST endpoint and WebSocket connection via Neon Auth (jose JWT/JWKS).
  • Implemented cloud asset persistence using Neon Object Storage (AWS SDK v3 S3-compatible) with multipart file uploads (Multer) and client-side canvas high-resolution PNG export.
  • Designed an intuitive, responsive infinite whiteboard surface using React 19, Framer Motion, and Tailwind CSS, featuring freehand vector sketching, text formatting, shape manipulation, interactive chart editing, and live presence indicators.

Challenges Faced

  • Minimizing network overhead and render stutter during high-frequency freehand drawing broadcasts across multiple connected collaborators. Solved with client-side coordinate throttling and binary delta streaming.
  • Ensuring robust token validation across both HTTP endpoints and persistent Socket.IO handshakes. Built unified middleware verifying Neon Auth JWT signatures against remote JWKS keys.
  • Eliminating vendor SDK lock-in and handling model variability across OpenRouter-supported models by implementing standard Node.js fetch with strict JSON Schema formatting for deterministic whiteboard element generation.

Potential Improvements and Future Plans

  • Introduce Conflict-Free Replicated Data Types (CRDTs via Yjs) for peer-to-peer offline-first editing and automatic conflict resolution.
  • Implement infinite canvas spatial indexing with QuadTrees to optimize viewport rendering performance when boards exceed 5,000+ elements.
  • Add real-time voice and video chat channels via WebRTC for seamless remote design sprints.