#πŸ” BurgerAPI

1 messages Β· Page 1 of 1 (latest)

merry turtle
#

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

https://www.npmjs.com/package/burger-api

slender dove
#

Nice! Ever since I started working with SvelteKit, I really enjoyed the experience of directory/filesystem server routing; that's why I started building xink.

I hope this way of doing api routers becomes a thing. And if it doesn't, I'll still enjoy it personally.

merry turtle
bronze orchid
merry turtle
merry turtle
short basalt
#

It feels kind of long for me

merry turtle
short basalt
#

Imo u should use typebox for validation

merry turtle
#

@short basalt will take a look into this
Typebox also send me link as well

#

@short basalt currently I am working on a page router so users can serve static and dynamic pages also going to update the API router as well
Will try to make it small

#

The reason I select zod most developers use it regularly also I will valibot

short basalt
#

Typebox schema is also just json schema

slender dove
#

@merry turtle For my initial validation strategy, I found it easiest to have the dev pass you a parse function with whatever validation library they want. Then all you do is call the function within your router. For my router, they have to pass one that throws on errors, then I allow them to define how to handle the thrown errors.

But you might also take a look at supporting Standard Schema - that's what I recently did.

short basalt
#

It has a builtin compiler that optimizes your schemas

#

Zod/Valibot/Typebox works

slender dove
merry turtle
merry turtle
#

Static Page Serving:
Basic support for serving static .html files
File-based routing for pages
Support for route grouping with (group) syntax
Support for dynamic route with [slug] syntax

🎯 What's Coming Next?
We're actively enhancing burger-api with powerful new features:

🎨 Page Serving Enhancements (In Development)
πŸ”₯ TSX Support: Adding TSX rendering capabilities
πŸ” Global Middleware: Applies to all pages routes.
πŸ” Page-Specific Middleware: Defined in individual route files for tailored processing.
πŸ› οΈ Advanced Middleware: More built-in middleware for common use cases:
CORS handling
Rate limiting
Request logging
Security headers
🎯 Performance Optimizations: Further leveraging Bun's capabilities for faster page serving
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.

https://www.npmjs.com/package/burger-api

merry turtle
#

Currently working on optimization

#

Here are some benchmark results
That I conduct using autocnon then I found that using autocanon can give you wrong results in case of bun.js that I read on bun official documentation

#

No I switched to bombardier

short basalt
merry turtle
#

These pictures are based on autocanon data which is wrong

#

If you do the same benchmark with the bombardier you will see the actual result currently I need to work on optimization as BurgerAPI is slow even if I compare it with hono

short basalt
merry turtle
#

Currently I am using fetch

#

For API router

#

I am running everything thing on bun jsb

#

Hono also

short basalt