CLI
Nifra is zero-config: it reads routes/, framework.ts, and (optionally) backend.ts from your project and wires the right @nifrajs/web entrypoint — no dev.ts/build.ts/server.ts to hand-write. (`create-nifra` scaffolds the conventions.)
nifra dev # true-HMR dev server (Vite middleware + nifra SSR) — http://localhost:3000
nifra build # bundle the client (content-hashed, code-split) + write dist/manifest.json (incl. CSS)
nifra start # serve the built client + SSR on Bun (assets, <link> stylesheets, matched-route preload)
# flags: --port <n> (dev/start) · --out <dir> (build/start) · --poll (dev; containers/sandboxes)The conventions
Three files at the project root. nifra dev runs the Vite-backed HMR dev server; nifra build runs the Bun-native production build (content-hashed, code-split, CSS bundled); nifra start serves the built client and SSRs on Bun — assets with immutable caching + correct MIME, the matched route's chunks preloaded, and the CSS bundle linked in every <head>.
my-app/
routes/ # file-based routes (index.tsx, _layout.tsx, [id].tsx, …)
framework.ts # adapter + clientModule + plugins (above)
backend.ts # export const backend = server()... (optional — the typed contract)framework.ts — naming the framework once
The single framework-specific file. Only adapter + clientModule are required; the plugin/condition fields are extras the compiler frameworks need (React/Preact's JSX is Bun-native, so they need none beyond the Vite plugin for dev HMR).
// framework.ts — the one place an app names its framework. The CLI reads these:
import react from "@vitejs/plugin-react"
import { reactAdapter } from "@nifrajs/web-react"
export const adapter = reactAdapter
export const clientModule = "@nifrajs/web-react/client"
export const vitePlugins = [react()] // dev HMR (Fast Refresh)
// Vue/Svelte/Solid also export:
// clientPlugins = [vueBunPlugin("dom")] // compile routes for the client build
// serverPlugins = [vueBunPlugin("ssr")] // compile routes for SSR (nifra start registers them)
// conditions = ["solid"] // Solid: resolve solid-js to its source
// define = { __VUE_OPTIONS_API__: "true", ... } // Vue feature flagsScope
nifra build + nifra start target a Bun (or Node) long-running server — the common self-hosted case. For the edge (Cloudflare Workers / Vercel Edge / Deno Deploy), use the per-target build entries from create-nifra's site template (see Deployment) — buildServer bundles a disk-less worker those targets need. A nifra build --target for edge is a future addition.