Key Concepts
BurgerAPI is a Bun-native framework for APIs and web apps. Here are the main ideas.
File-based routing
Routes are defined by your file and folder structure. Put route.ts files under your API directory (e.g. src/api), and BurgerAPI maps them to URLs. Same idea for static or dynamic pages. No manual route registration.
See File-Based Routing, Static Routes, and Configuration.
Burger instance and configuration
You create one Burger instance with options: apiDir, pageDir, apiPrefix, pagePrefix, globalMiddleware, and OpenAPI metadata. For production builds you can pass pre-built apiRoutes and pageRoutes instead of dirs.
See Burger Class, Server Options, and Configuration.
Middleware
Middleware runs before (and optionally after) your route handlers. Use it for auth, logging, CORS, etc. You can attach middleware globally or per route.
See Middleware System, Global Middleware, and Request Handling.
Zod validation
Request validation is done with Zod schemas. Define schemas for query, params, and body; BurgerAPI validates and attaches the result to req.validated.
See Zod Validation, Schema Definition, and Request Handling.
OpenAPI and Swagger UI
BurgerAPI can generate OpenAPI 3.0 from your routes and Zod schemas and serve Swagger UI for interactive docs.
See OpenAPI Generation, Swagger UI, and API Documentation.
CLI and builds
The Burger API CLI lets you create projects, add middleware, run a dev server, and build for production (burger-api build, burger-api build:exec). New projects get a burger.config.ts at the root.
See CLI Tool and Build Command.