Skip to content

About

burger-api is a modern, open source API framework built on Bun.js. It combines the simplicity of file-based routing with powerful features like built-in middleware, Zod-based schema validation, and automatic OpenAPI generation.

Resources

Code of conduct

Contributing

Stars

159 stars

Watchers

6 watching

Forks

Repository files navigation

BurgerAPI logo

A fast, file-based API framework for Bun, with TypeScript and JavaScript

Version 1.0.0-beta MIT License Bun 1.4.4+ Documentation

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.7 or @burger-api/cli@0.9.9? Read the migration guide.

Quick start

bunx @burger-api/cli create my-api
cd my-api
bun run dev

Open 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 });
}

Features

  • 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 in src/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.

Packages

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

Documentation

Everything is on burger-api.com: guides, API reference, deployment and examples.

Contributing

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

License

MIT © Isfhan Ahmed

About

burger-api is a modern, open source API framework built on Bun.js. It combines the simplicity of file-based routing with powerful features like built-in middleware, Zod-based schema validation, and automatic OpenAPI generation.

Resources

Code of conduct

Contributing

Stars

159 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages