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-first — no GraphQL and no RPC generator; if you need those, pick a different tool. Realtime endpoints are covered: a route file can export WebSocket handlers or an SSE stream.
About these docs
There is one documentation tree and it describes the current release — the version in the header, linked to the changelog. Anything added, changed, or removed in that release is marked in place:
Added in 1.0
Changed in 1.0
Removed in 1.0
On an older version, read Upgrading — it lists every breaking change per release, newest first — and Changelog for the full history.
bun add -g @hopak/cli
hopak new my-app
cd my-app
hopak dev
Next: Installation.