Package Exports
- burger-api
- burger-api/dist/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (burger-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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. Designed for high performance and ease-of-use, burger-api leverages Bun's native modules to deliver blazing-fast API responses while keeping your codebase clean and maintainable.
This project is under active development and should not be used in production yet.
📚 Table of Contents
📖 Documentation
For detailed documentation and examples, visit the BurgerAPI official docs.
🚀 Overview
burger-api is built to offer a robust developer experience through:
⚡ Bun-Native Performance:
Leverages Bun's high-performance HTTP server.📁 File-Based Routing:
Automatically registers API routes from your file structure using a clear naming convention.🔄 Middleware Architecture:
Supports both global and route-specific middleware. Simple, powerful middleware system with three return types:Response- Stop here, send this responseFunction- Transform the final response after handler runsundefined- Continue to next middleware
✅ Type-Safe Validation:
Utilizes Zod for request validation, ensuring full type safety and automatic error reporting.📚 Automatic OpenAPI Generation:
Generates a complete OpenAPI 3.0 specification directly from your routes and Zod schemas.🔍 Swagger UI Integration:
Out-of-the-box Swagger UI endpoint for interactive API documentation.
📣 Changelog
Latest Version: 0.6.2 (November 13, 2025)
⚡ Major Performance Improvements:
- middleware execution with specialized fast paths
- AOT compilation with pre-computed middleware arrays
- Zero runtime allocations (pre-allocated arrays)
- Manual loop unrolling for 2-middleware case
- Reduced code from ~110 to ~80 lines
🎯 Simplified Middleware System:
- Clearer return types: Response, Function, or undefined
- Removed complex "around" middleware pattern
- Dedicated fast paths for 0, 1, and 2 middlewares
- Better JIT optimization
📦 Monorepo Structure:
- Converted to Bun workspace monorepo
- Core framework in
packages/burger-api - CLI tool in
packages/cli(under development) - Ecosystem middleware at root level
🔧 Developer Experience:
- 100% backward compatible
- Clearer documentation
- Easier to understand codebase
Previous Version: 0.5.2 (November 9, 2025)
- 🔧 Internal Improvements:
- Refactored wildcard parameter extraction logic into reusable utility functions
- Added test suites and README files for all example projects
Previous Version: 0.5.0 (November 1, 2025)
🌟 Feature: Auto-injected OPTIONS handler for CORS preflight:
- Automatically injects an OPTIONS handler for CORS preflight when needed
- Only injects if the route defines any preflight-triggering methods and lacks an OPTIONS handler
- Injects a minimal OPTIONS handler that returns a 204 No Content response
- Works for all HTTP methods that trigger CORS preflight (POST, PUT, DELETE, PATCH)
- Does not inject if the route already has an OPTIONS handler
🌟 Feature: Improved response handling in middleware (after middlewares):
- After middlewares now run even if the current middleware already returned a response
- After middlewares run in reverse order to make changing the response easier and to help with CORS
🐛 Bug Fix: Fixed TypeScript type resolution for package consumers:
- Users now get full IntelliSense, autocomplete, and type safety out of the box
Previous Version: 0.4.0 (October 21, 2025)
- 🌟 Feature: Wildcard Routes:
- Added wildcard routes using
[...]folder name - matches any path after it - Create routes that handle multiple path segments automatically
- Access all matched path parts through
wildcardParamsin your request - Routes are matched in order: exact paths first, then dynamic routes
(like
[id]), then wildcards last - Works inside dynamic routes too (example:
/api/users/[userId]/[...]) - View wildcard routes in OpenAPI docs and Swagger UI
- Added wildcard routes using
Previous Version: 0.3.0 (August 15, 2025)
- 🌟 Feature: Updated Zod to version 4:
- Updated Zod version from 3.x to 4.x
- Updated built-in request validation middleware to use Zod 4
- Updated and better request validation middleware error handling
- Removed Zod-to-json-schema dependency and use Zod 4 directly
For a complete list of changes, please check the Changelog file.
🎯 What's Coming Next?
We're actively enhancing burger-api with powerful new features Stay tuned for updates as we continue to build and improve burger-api! We're committed to making it the best API framework for Bun.js.
🤝 Contributing
We welcome contributions from the community! If you have suggestions or improvements, please open an issue or submit a pull request. Let's build something amazing together.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
The MIT License is a permissive license that is short and to the point. It lets people do anything they want with your code as long as they provide attribution back to you and don't hold you liable.