Inspiration
HyperCard shipped on the Mac in 1987 and let people who'd never programmed build real things out of cards, buttons and fields, scripted in HyperTalk, a language that reads almost like English. Apple stopped selling it in 2004. Nothing since has quite filled that gap between "I can't code" and "I made a thing". Stacks is my attempt to bring it back where everyone already is: a browser tab.
What it does
- Premium dark or Classic: a restrained midnight-navy look by default (ice blue and silver accents, hairline borders, soft shadows), Ink/gold and Graphite/copper palettes in a menu, or the original 1-bit Mac look with one toggle. It respects reduced-motion.
- Its own look: a stacked-cards logo and favicon, inline SVG toolbar icons, cards that fade between each other in run mode, and a soft fade into Run.
- Starts with something: first visit shows a welcome screen with Open the Haunted House, a small playable adventure across five cards: Porch, Hall, Library, Crypt and Dawn. The porch door stays locked until you knock three times. The crypt stays locked until you have the key. The Library asks a riddle, and a wrong answer gets a dialog before Ravenwood works and hands you a brass key, kept in a stack variable
keyso it survives card changes. Then the crypt opens, and Carry the ledger takes you to Dawn. It's there to show fields, conditionals, state that lasts across cards, andanswerdialogs doing real work. (If you opened the old starter before, use a fresh or incognito window to see the welcome screen.) - Edit mode: a toolbar to add buttons and fields, add/rename/delete cards, a card list, a canvas, a properties inspector grouped into Identity, Content, Typography and Position & Size, and a script editor with a line-number gutter. The AI drawer docks beside the inspector instead of covering it. Click to select, drag to move, arrow keys to nudge, Ctrl+scroll to zoom.
- Run mode: one click on Run and the stack becomes an app. Buttons run their
mouseUphandlers, fields update,answershows a dialog, andgo next card/go previous cardmove between cards. - HyperTalk-style scripting:
put ... into field "X",go to,if/then/else,repeat,&string joins, arithmetic and comparisons, and handlers likeon mouseUp,on openCard. The script editor highlights syntax, underlines parse errors and shows "Valid" when a script parses. - AI script writer you can read: describe what you want and it writes a HyperTalk handler, shows you a diff, and you Accept or Discard. It works offline with a built-in local mock provider, or you can bring your own Anthropic or Ollama key. Your key stays in the browser tab and is never saved in stacks, exports or logs.
- Safe by design: a custom lexer, parser and interpreter. No
eval, nonew Function, and scripts can't reach the network or the page. - Keep and share: stacks auto-save to the browser, and Export/Import moves them around as JSON.
How I built it
I built it with Kiro, the CLI in headless mode, using spec-driven development. Kiro wrote the steering docs (product, tech, structure, language conventions) and a requirements/design/tasks spec, then built the app one task phase at a time. I checked every phase independently (clean install, build, full test run) before ticking anything. Four Kiro hooks run the tests on save, block unsafe patterns like eval and innerHTML, keep network calls inside the generator, and remind Kiro to keep the spec in sync with UI changes. The /.kiro folder is in the repo.
Stack: TypeScript, Vite, plain DOM (no framework), Vitest with happy-dom, fast-check property tests, and Cloudflare Pages. The suite has 871 tests (53 files), all passing on a clean install, plus headless Chromium smoke tests against the live site. There are no external requests and no web fonts.
Challenges
- Tests that passed for the wrong reason. Kiro's first "end-to-end" click tests called the runtime directly, and the app didn't even have a Run button yet. I made it rebuild them around real clicks, then broke the click handler on purpose to make sure the tests failed.
- Writing a language from scratch with no
eval: a lexer, a parser with HyperTalk's odd precedence (field "Count" + 1), and a sandboxed runtime with timeouts. - BYOK without leaks: making sure an API key never ends up in a saved stack, an export, undo history or a console log, and testing that at the
fetchlevel. - Simulated DOM vs. real browsers. happy-dom accepted a class-name pattern that real Chrome rejects. Loading the live build in headless Chromium caught it (a blank page), and it's fixed and covered by a test now. Layout bugs like clipped cards and off-centre run mode also only showed up in real-browser screenshots.
- Making the starter actually run. The Haunted House needed two interpreter gaps filled. The parser never emitted
put ... into stack name/card name(the runtime already stored scoped variables, and a bareputonly lasts for one click), andanswerinsideif/elsedidn't open a dialog. Both work now. Some gaps are still there:answernested only insiderepeatdoesn't open a dialog,go to cardmatches card ids rather than display names, andask,hideandplayaren't supported. - Small rough edges. The porch says "Someone knocked 1 times" after the first knock, and the inventory line updates after the key dialog closes rather than while it's open.
Accomplishments
- A working HyperTalk interpreter and card editor, built spec-first and checked phase by phase.
- A starter that's a real little game, not a counter, and passes its own tests.
- AI-written code that's short and readable, and stays in your hands to edit.
What I learned
Spec-driven work with an agent goes fast. The real job is checking that what it claims is true.
What's next
- Shareable stack links, more HyperTalk handlers than mouseUp, manual testing in Firefox, Safari and Edge (only headless Chromium is tested so far), and
ask/hide/play, going to cards by name, and fixing the "1 times" wording.
Built With
- anthropic-api
- cloudflare-pages
- css
- fast-check
- fflate
- happy-dom
- html
- kiro
- kiro-cli
- ollama
- typescript
- vite
- vitest