BurgerAPI v0.6.2 Released
We're excited to announce the release of BurgerAPI v0.6.2! This update focuses on performance optimization, architectural simplification, and improved project structure while maintaining 100% backward compatibility.
๐ What's New in v0.6.2โ
Version 0.6.2 (November 13, 2025)โ
- Performance: Specialized fast paths for middleware execution
- Simplified: Cleaner middleware system with three clear return types
- Monorepo: Workspace structure for better organization and future CLI tool
- Code Quality: Reduced middleware processing from ~110 to ~80 lines
- Backward Compatible: All existing applications work without any changes
๐ฏ Introductionโ
This release represents a maturation of the BurgerAPI framework. Instead of adding new features, we focused on making what exists faster, simpler, and more maintainable. The result? Better performance, clearer code, and a solid foundation for future tooling.
โก Performance Improvementsโ
We've optimized the middleware execution system through careful code refinement, focusing on the most common use cases.
Specialized Fast Pathsโ
Different execution paths optimized for common scenarios:
- 0 middlewares: Direct handler call (no overhead)
- 1 middleware: Dedicated fast path for single middleware
- 2 middlewares: Manually unrolled execution (most common in production)
- 3+ middlewares: Optimized loop with pre-allocated arrays
Key Optimizationsโ
AOT (Ahead-of-Time) Compilation: Routes are now compiled at server startup with pre-computed middleware arrays, reducing runtime overhead.
Zero Runtime Allocations: Pre-allocated arrays eliminate dynamic memory allocations during request processing.
Better JIT Optimization: Separated methods allow JavaScript engines to optimize each execution path independently.
Code Reduction: Simplified middleware processing while improving clarity.
What This Means for Youโ
- Faster request handling
- Lower memory usage during request processing
- Better performance under high load
- All improvements are automatic - just upgrade!
๐ก Simplified Middleware Systemโ
We've simplified the middleware architecture for a better developer experience.
Three Clear Return Typesโ
import type { BurgerRequest, Middleware } from "burger-api";
// 1. Return Response: Stop execution, return immediately
const authMiddleware: Middleware = (req) => {
if (!req.headers.get("authorization")) {
return Response.json({ error: "Unauthorized" }, { status: 401 }); // Stop execution, return immediately
}
return undefined; // Continue to next middleware or handler
};
// 2. Return Function: Transform response after handler completes
const corsMiddleware: Middleware = (req) => {
return async (response) => {
const headers = new Headers(response.headers);
headers.set("Access-Control-Allow-Origin", "*");
return new Response(response.body, {
// Transform response after handler completes
status: response.status,
headers,
});
};
};
// 3. Return undefined: Continue to next middleware
const loggingMiddleware: Middleware = (req) => {
console.log(`${req.method} ${req.url}`);
return undefined; // Continue to next middleware or handler
};
๐๏ธ Monorepo Architectureโ
We've transitioned to a Bun workspace monorepo structure, setting the foundation for exciting future features.
Better Organizationโ
burger-api/
packages/
burger-api/ โ Core framework (published to npm)
cli/ โ CLI tool (under active development)
ecosystem/ โ Ready-to-use middleware templates (under active development)
Benefits for Usersโ
- Production-Ready Templates: Ecosystem middleware you can copy and customize or install with CLI tool
- Upcoming CLI Tool: Scaffold projects and add middleware with a single command
- Cleaner Separation: Framework core and tooling are properly isolated
- Better Maintenance: Each package has its own dependencies and tests
๐ฆ Upgrade to v0.6.2โ
Great news: This release is 100% backward compatible!
Update your project to get performance improvements automatically:
bun add burger-api@latest
All existing code works exactly as before.
๐ฎ What's Nextโ
We're building a complete ecosystem around BurgerAPI:
- CLI Tool: Command-line tool for scaffolding new projects and adding middleware
- More Ecosystem Templates: Additional production-ready middleware patterns
- Enhanced Documentation: More examples, guides, and best practices
- Community Growth: Building a stronger ecosystem together
๐ค Get Involvedโ
BurgerAPI is open source and we welcome contributions!
- โญ Star us on GitHub
- ๐ Report issues
- ๐ก Share ideas
- ๐ค Contribute code
Stay tuned for more updates and happy coding with BurgerAPI! ๐
