DrawScape
A shared canvas for turning architecture ideas into diagrams.
Overview
DrawScape is a collaborative architecture whiteboard built with HTML Canvas. It combines familiar drawing interactions with shared WebSocket rooms and PostgreSQL persistence. The interface supports shapes, arrows, text, and images, along with selection, resizing, undo/redo, zoom, and pan.
Architecture
Scroll to explore the connections, or use Fit to see the full diagram.
HTTP writes first; room events synchronize connected canvases
- Canvas changes go through the authenticated HTTP API and are persisted before the request succeeds.
- WebSocket connections authenticate, join rooms with an after cursor, and read the shared ordered event log. Connections in different processes can observe the same durable events.
- Clients reconnect with a cursor to replay missed changes. HTTP polling provides a fallback when WebSockets are unavailable.
Component responsibilities
Durable HTTP writes
The Next.js app reuses the Express API. Changes are authenticated, validated, and persisted before HTTP success is returned.
Shared event log
Prisma/PostgreSQL stores room and shape data with ordered events that can be read across server processes.
Realtime and recovery
WebSocket clients authenticate and join with an after cursor for live events and replay. HTTP polling is the fallback when WebSockets are unavailable.
Why I built this
I wanted a practical way to sketch architecture ideas with other people while learning how a drawing editor works underneath the interface. DrawScape combines canvas interactions, shared state, and persistence in one project.
Use case
Developers discussing an application design can draw shapes, connect them with arrows, add text, and collaborate in a shared room before returning to the saved canvas later.
What I learned
- Implementing editor interactions such as selection, resizing, undo/redo, zoom, and pan.
- Keeping a shared canvas synchronized through authenticated WebSocket rooms.
- Connecting canvas state to a Prisma and PostgreSQL persistence layer.
Key features
A complete drawing toolkit
Combine shapes, arrows, text, and images to communicate an architecture or idea.
Canvas interactions
Select and resize elements, undo or redo edits, and navigate the canvas with zoom and pan.
Shared, persistent canvases
Authenticated WebSocket rooms keep collaborators in sync, with PostgreSQL persistence for saved work.


