SawBox Planner
SawBox is a kitchen and cabinet planner that runs entirely in the browser, on a phone as well as a desktop. Draw your walls, place cabinets from a catalogue, adjust them by dragging or typing exact sizes, and finish with dimensioned elevations of every wall, ready for the shop.
- 54k-line engine in Dado
- Shell in DadoScript
- ~40 typed boundary calls
- 42k lines of tests
Under the hood it's two programs with a strict division of labour. The engine, written in Dado and compiled to WebAssembly, makes every decision: geometry, the cabinet construction kernel, snapping, collisions, gesture recognition, undo and the file format. The shell, written in DadoScript, only presents what the engine publishes. The engine never calls into JavaScript; the two talk over three narrow channels.
That boundary replaced several hundred foreign-function calls in the previous version with about forty typed ones. All the hand-written JavaScript fits in a few hundred lines.
- typed commands in
- versioned view-models out, read only when their revision changes
- a zero-copy bridge over WebAssembly memory, for meshes and documents
How SawBox Planner is built
Real geometry, not boxes
Each cabinet is built panel by panel by a parametric kernel: carcass, faces, reveals, toe-kicks and interiors. The engine ships its own geometry library:
- a bounding-volume hierarchy for picking;
- separating-axis collision with minimum-translation push-out, so a dropped cabinet slides out flush instead of sitting inside its neighbour;
- polygon triangulation and half-edge meshes;
- a full port of the Clipper2 polygon-clipping library.
Walls snap at their ends and where one meets another mid-length, keep their corner joints when a length changes, and take window and door openings. Cabinets seat against walls, attach to each other's sides, align, link into groups that move together, and stretch to fill a gap.
A layered engine
The engine is about 54,000 lines in seven tiers, from the core libraries up to the app. A linter enforces the layering, and the public API can only grow: nothing is ever removed from it. The app reaches the engine through exactly one package.
Rendering
- three.js with batched geometry, so a full kitchen draws in about a dozen draw calls;
- Phong materials with photo textures and a three-light rig;
- shadows fitted to the objects that cast them, recomputed only when the scene changes;
- ambient occlusion through a post-processing chain, all of it tunable from Settings.
Drawings and collaboration
Elevations switch to an orthographic view with dimension chains packed into lanes, and you can edit those dimensions in place. Projects can be co-edited: owners, editors and view-only guests share camera poses and record changes live.
Engineered to be trusted
- About 42,000 lines of tests in 175 files, compiled into one program and run both natively and as WebAssembly in the browser.
- 29 automated browser checks that drive the real page with real pointer input.
- A single gate that runs all of it in under five minutes, or it fails.
Saved files and the host interface stay byte-compatible with the previous version, so the rewrite is a drop-in replacement.

