JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q77867F
  • License MIT

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

BurgerAPI logo

Under Development License Bun Version

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.

    • After middlewares (functions returned by a middleware) run after the route handler.
    • They now run even if an earlier middleware returned a Response, so post-processing is reliable.
    • They run in reverse order and are useful for adding CORS headers, logging, or tweaking the final Response.
  • 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 (with support for tags, summaries, descriptions, operationId, deprecated status, externalDocs, and more) directly from your routes and Zod schemas.

  • 🔍 Swagger UI Integration:
    Provides an out-of-the-box Swagger UI endpoint for interactive API documentation.

📣 Changelog

Latest 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 wildcardParams in 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

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.