Draw-to-Web
Draw a rectangle on a canvas, get semantic HTML and CSS out the other end. Not a screenshot-to-div converter — a document model you compose visually, which then goes through a generator, an SEO pass, validation, and an accessibility gate before it becomes a file.
Built by three of us as a term project at Antioch Syrian Private University. I owned the Electron shell, the IPC bridge, the code-generation engine, the SEO injector, the export pipeline and CI/CD.
The one-directional rule
UI → Document Store → Generator → SEO → Validation → Export (axe gate → minify → ZIP) → IPC → fs.writeFile
The rule that keeps this from turning into a mess: the UI writes to the store, the generator reads from the store, and the canvas is a rendering of the document tree — never the model itself. Every feature that tried to shortcut that (read layout back out of the DOM, let the canvas own a piece of state) got walked back, because as soon as the canvas is authoritative for anything, export and undo start disagreeing with what you see.
The document model is typed with Zod, which does double duty — it’s the schema for the
saved file and the validation boundary on IPC, so a malformed document can’t cross from
renderer to main and reach fs.
The accessibility gate
axe-core runs on the generated output at export time, and critical or serious violations block the export. Not a warning panel, not a score. If the page you drew has an image with no alt text, you don’t get a ZIP.
That was contentious on the team and I still think it’s right. A warning you can dismiss is a warning everybody dismisses, and the whole point of generating the markup is that the tool knows more about correct markup than the person drawing the rectangle does.
Zero-JavaScript by default
Output is HTML and CSS with no JS unless you ask for it. The runtime behaviours — theme toggle, scroll-spy, mobile menu, reveal animations, terminal typing — are opt-in vetted snippets, each independently toggleable. All flags off produces a page with no script tag at all.
v1.0.0
Three things landed together: draw-to-create (sketch a shape, it’s interpreted into a placed primitive), match my layout (take a rough draft and adopt one of six bundled designs), and a headless MCP server that drives the same document, generate and export pipeline over stdio without Electron at all.
The MCP server was only cheap to build because of the one-directional rule above — the
authoring surfaces (src/draw/, src/match/, mcp/) are headless at the core, reusing the
same operations and export pipeline the UI uses. If the canvas had owned state, none of
that would have been reachable without Electron running.
Stack
Electron 28, React 18, TypeScript 5. Zustand with immer patches for the document store and undo/redo, @dnd-kit and react-arborist for canvas drag-and-drop and the layers tree, Radix UI primitives, Zod for schema and IPC validation, sharp for the WebP/srcset image pipeline in the main process, prettier + lightningcss + html-minifier-terser on the output, axe-core as the export gate, and the MCP SDK for the headless server.
Vite and electron-vite for dev, electron-builder for packaging — AppImage and .deb on Linux, NSIS on Windows, dmg and zip on macOS, each built natively in CI. 1,042 Vitest tests across document, generator, runtime, SEO, export, templates, store, UI, draw, match and MCP.