This adapter allows Astro to deploy your SSR site to Bun targets.
All functionality offered in astro-bun-adapter
is also available in this project, along with some additional features:
-
Hybrid Output Support: You can now use
"output": "hybrid"
in yourastro.config.mjs
to output both static and server-rendered pages. - Improved server URL logging: The URL printed to the console when the server is started now shows the full URL rather than just the port.
-
Process exit & shutdown handlers: Added support for
process.on
handlers for when the server exists, or interceptsSIGINT
andSIGTERM
signals.
- Install the required dependencies
bun add @nurodev/astro-bun
- Add the integration to your astro config
+import bun from "@nurodev/astro-bun";
export default defineConfig({
+ adapter: bun(),
+ output: "hybrid",
});
- Update your
package.json
start
script
{
"scripts": {
- "start": "astro dev"
+ "start": "bun run ./dist/server/entry.mjs"
}
}
This package is structured as a monorepo:
-
playground
contains code for testing the package -
package
contains the actual package
Install dependencies using pnpm:
bun i --frozen-lockfile
Start the playground and package watcher:
bun dev
You can now edit files in package
. Please note that making changes to those files may require restarting the playground dev server.
MIT Licensed. Made with ❤️ by Ben Dixon.
-
@ido-pluto, and subsequently @andremralves: This project is massively based on
astro-bun-adapter
on but with some improvements added. -
@florian-lefebvre: The structure & a lot of copy text is based on their
astro-integration-template
project template.