BunSai
Bonsai is a japanese art of growing and shaping miniature trees in containers
BIG NOTE
As the version implies (v0.x.x), this API is not yet stable and can be breaking changed without warnings.
Quick start
BunSai is a full-stack, zero (production) dependency, agnostic framework for the web, built upon Bun and Elysia. You can install it:
bun add bunsai
And use it as a command:
bun run bunsai
How it works?
Powered by Bun.build
, Elysia's routing system and some fancy tricks, BunSai takes an approach where each plugin declares which file extensions they want to work with. Then the app
folder is scanned using new Bun.Glob('app/**/*{<extensions>}')
. The matched files pass through building
and scripting
both for Bun and for the web. Finally, BunSai generates a script that exports an Elysia instance.
Rules
Most of the rules are dictated by the plugins, but there are a few "global" rules.
Dynamic path
- Path parameters must use
[foo]
sintax. Can be used in a folder (app/[foo]/index.svelte
) or a file (app/[foo].svelte
) - Wildcards must use
[...]
syntax. Should be used only in a file (app/bar/[...].svelte
)