A fast, file-based API framework for Bun, with TypeScript and JavaScript
1.0.0-beta is a new BurgerAPI. The framework and the CLI were rewritten from the ground up: a new core, a hook-based lifecycle, plugins, Standard Schema validation and more. Coming from
burger-api@0.9.7or@burger-api/cli@0.9.9? Read the migration guide.
bunx @burger-api/cli create my-api
cd my-api
bun run devOpen http://localhost:4000/docs to see your API documentation.
A route is a folder with a route.ts file:
// src/api/users/[id]/route.ts → GET /api/users/:id
import type { BurgerContext } from 'burger-api';
export async function GET(ctx: BurgerContext) {
return Response.json({ id: ctx.params.id });
}- File-based routing: folders become URLs, with
[param]and[...]wildcard routes. - Hooks: six lifecycle points (
onRequest,transform,beforeRoute,afterRoute,mapResponse,onError), global or per route. - Validation: Zod, Valibot or ArkType for body, query, params, headers,
cookies and responses, with fully typed
ctx.validated. - OpenAPI 3.1: generated from your routes, with Swagger UI, Scalar or Redoc
at
/docs. - Plugins and providers: add features in
src/plugins.ts, share services insrc/providers.ts. - WebSockets and pages: file-based, next to your API.
- Runs everywhere: Bun, Node, Cloudflare Workers, Deno and Vercel.
- Fast: every route becomes a native Bun route.
| Package | Description |
|---|---|
burger-api |
The framework |
@burger-api/cli |
Create, run, build and check projects |
@burger-api/node-server |
Run a burger-api app on Node.js |
ecosystem/ |
Official hooks and plugins, installed with burger-api add |
Everything is on burger-api.com: guides, API reference, deployment and examples.
Bug reports, ideas and pull requests are welcome. See CONTRIBUTING.md to set up the repo and run the tests.
bun install
bun run test:all