Skip to content

An Astro adapter that allows you to run your SSR site with Bun's native API.

License

Notifications You must be signed in to change notification settings

andremralves/astro-bun

Repository files navigation

astro-bun

This adapter allows Astro to run your SSR site with the Bun's native API Bun.serve.

Prerequisites

  • Bun

Installation

  1. Install astro-bun package
bun add astro-bun
  1. Update your astro.config.mjs to use astro-bun adapter.
// astro.config.mjs
import { defineConfig } from 'astro/config';
import bun from 'astro-bun';

export default defineConfig({
  output: 'server',
  adapter: bun(),
});
  1. Build your project.
bunx --bun astro build

This will generate an entry.mjs script inside ./dist/server.

  1. Run the entry.mjs script.
bun run ./dist/server/entry.mjs

or, you can update the preview script in you package.json.

// package.json
{
  // ...
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "bun run ./dist/server/entry.mjs"
  }
}

and then just run:

bunx --bun astro preview

About

An Astro adapter that allows you to run your SSR site with Bun's native API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published