Zero-build web apps (vanilla JS, localStorage, single file)
vanilla-jses-moduleslocalstorageindexeddbprototypingpython-http-server
For a local, single-user tool or a quick prototype, plain HTML, CSS and JavaScript with no framework and no build step is often the best stack: it runs instantly, has nothing to install or upgrade, and can be handed to anyone as one file. Several of Justin's July 2026 builds used it (WTF idea tracker, The Big Top circus, Story dictation app, the target-poll game, Backyard Power walkthrough, AnimateStudio). This article collects what they taught.
When to choose it
- Local single-user tools where data can live in the browser.
- Anything that leans on browser APIs (microphone, Web Speech, Web Audio, canvas) that
work natively on
localhost, which counts as a secure context. - Prototypes whose stack the user has not chosen yet; offer a heavier version (Flutter, PHP + MySQL sync) as a follow-up instead of starting there.
Serving it
- ES modules do not load from
file://.<script type="module">needs HTTP. Serve the folder:python3 -m http.server 8420 --bind 127.0.0.1 -d ~/dev/app, or for PHPphp -S 127.0.0.1:8123 file.php. Verify withcurl -I, then hand over the URL. file://andhttp://127.0.0.1:PORTare different origins, so their localStorage and IndexedDB are separate. Data entered while the file was opened directly "disappears" when the same app is served. Pick one origin early; an export/import JSON feature bridges the two. Different ports are also different origins.- Background servers die on reboot; note the port and the restart command.
Persistence patterns
- localStorage for small JSON: one versioned key per collection
(
wtf.items.v1,story-app.stories,backyard-power-progress-v1) so a future schema change can migrate. Debounce autosave (~400 ms). - IndexedDB for blobs such as audio recordings (an object store with a
storyIdindex); delete child records when the parent is deleted. - IDs:
crypto.randomUUID()(secure contexts) orDate.now().toString(36)plus a random slice. - Always add Export JSON / Import JSON (merge by id, skip duplicates). It is the backup and the migration path.
Swappable mock APIs
When the backend does not exist yet, put the API behind one module (api.js) exporting
promise-returning functions (getOptions(), postVote(), getResults()). The mock
version keeps state in memory, seeds non-zero data so charts are not empty, adds simulated
latency (~150 ms), returns structuredCloned objects, and rejects invalid input like the
real server would. Put the real fetch implementation beside each mock as a comment, so
switching touches only that file.
Checking it without a browser
node --check file.jstreats.jsas CommonJS and errors onimport. Copy the file to.mjsfirst (or extract an inline<script>block to a.mjsfile) and check that.- A syntax check proves nothing about rendering. Load the page in headless Chrome
(
google-chrome --headless=new --virtual-time-budget=2500 --dump-dom URL) and grep the DOM for rendered elements, or take a screenshot. See Headless Chrome testing gotchas.
Small reusable ideas
- Weighted "what should I do?" picker (WTF app): pick randomly among open items with weight = interest squared times an effort bonus (small 3, medium 2, large 1). Interesting and easy items float up but long shots still come up sometimes.
- Wizard with checklists (Backyard Power): all content in one data array of steps
(
id, title, intro, warning, tip, checklist[]), progress in localStorage, arrow-key navigation, a reset button. - Artifact-hosted pages (claude.ai artifacts) run under a CSP that blocks CDNs and web fonts. Generate everything procedurally and use system font stacks.
See also
- Canvas 2D and SVG animation techniques for web scenes
- Browser dictation with Web Speech and MediaRecorder
- Headless Chrome testing gotchas
Linked from
- A production vanilla-JS single-page app (no framework, no build)
- Browser dictation with Web Speech and MediaRecorder
- Canvas 2D and SVG animation techniques for web scenes
- Procedural music and sound effects with the Web Audio API
- Running power to the backyard (outdoor circuits, burial depth, GFCI)
- Simulating Chladni figures (sand on a vibrating plate)
- Static trivia and quiz games (daily sets, question banks, fact checking)
- Wave function collapse for island terrain (and why it never contradicts)