Introduction
What Hopak is, when to reach for it, and the core mental model.
Hopak is a backend framework for Bun. It scaffolds REST services from plain files — you write models and route files, the CLI writes the rest.
The mental model is the opposite of runtime magic: everything is a file on disk. CRUD endpoints, migrations, dev certificates — they are generated by hopak generate and live in your source tree as plain code you can read and edit. The runtime just executes whatever is in your files. Nothing is synthesized from a flag at boot.
One model file defines a table, the TypeScript row type, and the validator. Run hopak generate crud <name> and six REST endpoints land as two route files. Start the server with hopak dev and the schema materializes via CREATE TABLE IF NOT EXISTS. Typed ctx.db.model('post') clients are generated from the same models you already wrote.
Reach for Hopak when you want a typed REST backend on Bun with the lowest possible distance from “empty folder” to “working endpoint”. It is REST-only — no GraphQL, no WebSockets, no RPC generator. If you need those, pick a different tool.
bun add -g @hopak/cli
hopak new my-app
cd my-app
hopak dev
Next: Installation.