Self-hosting
Build Rebask with Vite and serve the production output from your own server. For Vercel, use the Vercel adapter.
Set up a server
Rebask doesn’t bundle an HTTP server by design. It focuses on routing and rendering and exposes a fetch handler that can run on any server.
Nitro is the recommended default: it runs the Rebask handler and provides presets for Node, Bun, and other deployment targets. Install the Nitro adapter:
pnpm add @rebask/nitroAdd rebaskNitro() to your Vite plugins:
import { rebask } from "@rebask/core/vite"
import { rebaskNitro } from "@rebask/nitro"
import react from "@vitejs/plugin-react"
import rsc from "@vitejs/plugin-rsc"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [
rsc(),
react(),
rebask(),
rebaskNitro({
preset: "node-server",
serverDir: "./server",
}),
],
})Change preset to match your Nitro deployment target, then deploy with any Nitro target. See
Nitro deployment .
PPR is available on the filesystem-basednode-serverandbunpresets. Other Nitro targets run the app without PPR.
Custom servers
For Elysia, Fastify, or another server, load Rebask's proxy and app handlers:
import { loadHandlers } from "@rebask/core/handlers"
const { handleProxy, handleApp } = await loadHandlers({
root: new URL("./dist/", import.meta.url),
})Call them in the order your server needs. handleProxy returns null when no proxy route answers,
so you can place your own routes or static files before or after either handler:
const proxied = await handleProxy(request)
if (proxied) return proxied
// your static files and routes
return handleApp(request)PPR works when the build cache and manifest are present. Servers that only
expose Node req/res need a small request adapter.