Production
Building
sh
bun run buildThis runs vite build, which:
- Generates
.fulgur/start.tsand.fulgur/vercel.ts. - Builds your client bundle into
dist/.
Two runners
Fulgur provides two production runners depending on your deployment target:
| Runner | File | Use case |
|---|---|---|
| Standalone | .fulgur/start.ts | Docker, VPS, Railway, Fly.io, ... |
| Vercel | .fulgur/vercel.ts | Vercel serverless functions |
Both files are generated automatically — you never write or edit them.
Standalone runner
sh
bun run start
# runs: bun .fulgur/start.tsThe standalone runner:
- Serves static files from
dist/. - Mounts all API routes under
/api. - Falls back to
index.htmlfor non-API routes (SPA support). - Exposes a health check at
/api/_fulgur/health(useful for Docker/K8s).
Docker
dockerfile
FROM oven/bun:1 AS base
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build
EXPOSE 3000
CMD ["bun", ".fulgur/start.ts"]Any host
Since Fulgur runs as a standard Bun process, it works anywhere you can run bun:
sh
bun install && bun run build && bun .fulgur/start.tsVercel runner
The Vercel runner is optimized for serverless. It exports the Elysia instance as a default export, which Vercel wraps in a serverless function. Static files are served by Vercel's CDN.
Create an api/index.ts file at your project root:
ts
// api/index.ts
export { default } from "../.fulgur/vercel";Add a vercel.json at your project root:
json
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"bunVersion": "1.x",
"rewrites": [
{ "source": "/api/(.*)", "destination": "/api" },
{ "source": "/(.*)", "destination": "/index.html" }
]
}The bunVersion field tells Vercel to use the Bun runtime. The rewrites route API requests to your Elysia function and everything else to index.html (SPA fallback).
