Skip to content
Projects

About

Infinite whiteboard for system design & LLD diagrams — AWS templates, connectors that stay attached, and alignment guides. Runs fully in the browser.

Design & Media

How these counts are measured

7 stars0 Forks +1 in 24h

Measured star growth

in 24h
+1
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Drawer

An infinite whiteboard for system design and low-level design diagrams.

→ Open the live board

MIT licence Built with Next.js No backend

A three-tier AWS web application diagram on the Drawer board

Pen, shapes, arrows, text and sticky notes on a pannable, zoomable canvas — plus AWS architecture templates, connectors that stay attached to the shapes they join, and alignment guides that snap things straight. Nothing to install and nothing to sign into: it runs entirely in your browser and saves as you go.

Running it

npm install
npm run dev     # http://localhost:3000

npm run build produces a fully static site in out/ — the board is client-side only, so there is no server to run. Serve that folder with anything:

npx serve out

Deploying

A push to main builds and publishes to GitHub Pages via .github/workflows/deploy.yml. Enable it once in Settings → Pages → Build and deployment → Source: GitHub Actions; the site then lands at https://<user>.github.io/drawer/.

Note that GitHub Pages only serves private repositories on paid plans. On a free account the repository has to be public for Pages to work — or deploy the same out/ folder to Vercel, Netlify or Cloudflare Pages, all of which serve private repos on their free tiers.

The workflow passes the project's base path (/drawer) to the build as NEXT_PUBLIC_BASE_PATH, which next.config.mjs turns into basePath and assetPrefix. To host at a domain root instead, leave that variable unset.

What it does

  • Draw — freehand pen, rectangle, ellipse, diamond, line, arrow
  • Write — text anywhere (double-click empty canvas), sticky notes, and labels bound to shapes (double-click a shape)
  • Connect — hover or select a shape to get four connection dots; drag one onto another shape to join them. Connectors stay attached when you move or resize either end, pick the facing edges automatically, and curve smoothly when the two shapes aren't in line. Drag an arrow end onto a different shape to re-attach it, or onto empty canvas to detach it.
  • Align — dragging shows dashed guides when edges or centres line up with other shapes, and snaps the last few pixels. Hold Alt to ignore them.
  • Right-click — on empty canvas, a quick shapes menu plus paste-here, select-all and templates; on a shape, its actions (edit, duplicate, reorder, delete). On a touch screen, press and hold instead.
  • Format text — a toolbar appears above whatever you're typing in, with size, bold, alignment and colour. Works on free text, sticky notes and shape labels.
  • Templates — AWS system-design diagrams, an interview scaffold, and LLD diagrams (class, sequence, state machine, ER), plus a palette of ~40 labelled AWS service nodes grouped by category
  • Erase — eraser tool, or select and delete
  • Edit — move, resize from any handle, multi-select by dragging a marquee or shift-clicking, duplicate, reorder front/back, nudge with arrow keys
  • Style — stroke and fill colours, three stroke widths, solid/dashed/dotted, opacity, four text sizes. With nothing selected the panel sets the defaults for what you draw next; with a selection it restyles it.
  • Navigate — scroll or space-drag to pan, Ctrl+scroll to zoom, zoom-to-fit
  • Touch — pinch with two fingers to zoom, drag with two to pan; one finger draws, selects and moves. The chrome reflows for a phone: the file actions collapse behind one button and the tool strip, style panel and zoom controls stack above one another instead of overlapping.
  • Keep — the board autosaves to localStorage; export PNG (selection or whole board), or save/open a .json board file

Press ? in the app for the full shortcut list.

How it's put together

Path What's in it
lib/types.ts The element model. Every element is a box (x, y, w, h) plus a type-specific payload, which is what makes one resize path work for all of them.
lib/geometry.ts Coordinate transforms, bounding boxes, hit testing, resize maths, and applyBindings — the connector engine.
lib/snap.ts Alignment guide detection and drag snapping.
lib/templates.ts The AWS palette, node factories, the Sheet layout builder and every template definition.
lib/render.ts All canvas drawing: grid, elements, selection chrome, PNG export.
lib/useScene.ts Element list plus undo/redo. A drag calls begin()/end() so the whole gesture lands as one history entry.
lib/board.ts Defaults, palettes, element factories, save/load/parse.
components/Board.tsx The canvas, the pointer gesture state machine, keyboard shortcuts, the text editing overlay.
components/*.tsx The floating UI: toolbar, top bar, style panel, zoom bar, help.

Rendering is a single <canvas> repainted in full on every state change. For board-sized scenes that is comfortably fast and keeps the code simple; if you ever push it to thousands of elements, the thing to add is a dirty-rect or layered-canvas pass in drawScene.

Text is edited with a real <textarea> positioned over the canvas and styled to match the rendered text, so you get native caret, selection and IME behaviour for free.

Connectors store a binding ({id, side}) per end rather than fixed coordinates. applyBindings recomputes the geometry of every bound arrow and runs on every scene change, including undo, import and template insertion. It is idempotent and drops bindings whose target is gone, so there is exactly one place that decides where an arrow actually lands. side: "auto" re-picks the facing edge each time, which is why arrows reroute sensibly as you drag shapes around.

The edge pair comes from autoSidePair: shapes side by side connect straight across, stacked shapes connect straight down, and diagonal shapes leave sideways and arrive from above or below. The connector is then drawn as a cubic bezier whose control points run along those edges' normals — so it leaves and arrives square to each shape, and collapses to a straight line by itself when the two anchors face each other. No separate "straight" and "curved" code paths.

Template thumbnails are produced by renderToCanvas — the same renderer the board uses — so a preview can never drift from what gets inserted.

Licence

MIT — free to use, modify and distribute.

Credits

Created by Sohail Haider.

Explore related projects

Loading…