@bractjs/bractjs
v0.3.2
Published
Production-grade SSR framework for Bun + React 19. File-based routing, streaming SSR, server actions, typed routes.
Maintainers
Readme
BractJS
Production-grade SSR framework for Bun + React 19. File-based routing · Parallel loaders · Streaming SSR · Built-in HMR · Server Actions · Typed routes · Single-binary deploy.
Requirements
- Bun ≥ 1.1 — no Node.js support
- React 19 (peer dependency)
Quickstart
# Scaffold a new app
bunx bractjs new my-app
cd my-app
# Start the dev server (HMR on http://localhost:3000)
bun run devOr add it to an existing project:
bun add @bractjs/bractjs react react-domreact and react-dom v19 are peer dependencies — BractJS ships zero other runtime deps.
Highlights
- File-based routing — params (
[id]), optional segments ([[id]]), catch-alls, route groups ((group)/), nested layouts. - Loaders & actions — parallel loader execution, streaming
defer(),<Await>, typeduseLoaderData<typeof loader>(). - Server Actions (
"use server") and typed/apiroutes (route()+createClient) with CSRF protection by default. - Middleware — global pipeline (
cors,csp,authGuard,requestLogger) plus per-route nested middleware. - Client runtime — soft navigation, prefetching, fetchers with optimistic UI,
<Toaster>, scroll restoration. - Selective SSR, SPA mode, and prerendering (SSG) per route or app-wide.
- Single-binary deploy —
bractjs compilepackages your app withbun build --compile.
Documentation
The full step-by-step guide to every export lives in the repository:
CLI
bractjs new <name> Scaffold a new app
bractjs dev Dev server with HMR
bractjs build Production build
bractjs start Production server
bractjs codegen Generate typed-route definitions
bractjs compile Single-binary build (bun build --compile)