⚠️ RebaseJS is under active development and not yet production-ready. APIs may change before v1.0. Feel free to explore, contribute, or star the repo.
Skip to content

The rebase CLI is installed locally in your project. Run it via your package manager's script runner or node_modules/.bin/rebase.

Commands

rebase dev

Starts the development server with hot module replacement.

bash
rebase dev
rebase dev --port 4000
rebase dev --host 0.0.0.0
FlagDefaultDescription
--port3000Port to listen on
--hostlocalhostHost to bind

The dev server:

  • Compiles TypeScript with the Rust/oxc compiler
  • Runs Vite HMR for instant CSS and component updates
  • Streams SSR using renderToPipeableStream
  • Enforces server/client boundaries at dev time
  • Shows rich error overlays with Rust-sourced line numbers

rebase build

Builds the app for production.

bash
rebase build
rebase build --mode spa
rebase build --analyze
rebase build --skip-typecheck
FlagDefaultDescription
--modessrBuild mode: ssr or spa
--analyzefalseOpen bundle size treemap after build
--skip-typecheckfalseSkip tsc --noEmit

SSR mode (default): Outputs a Node.js server bundle to .rebasejs/dist/. Requires a Node.js runtime to serve.

SPA mode: Outputs a static index.html + hashed assets to .rebasejs/dist/spa/. Deployable to any CDN. Server functions become fetch calls to /_rebasejs/fn/* — point these at a separate API server.

The --analyze flag requires rolldown-plugin-visualizer or rollup-plugin-visualizer to be installed:

bash
pnpm add -D rolldown-plugin-visualizer

rebase start

Serves the production build.

bash
rebase start
PORT=8080 rebase start
Environment VariableDefaultDescription
PORT3000HTTP port
HOST0.0.0.0Bind address
PUBLIC_URLPublic base URL (for sitemap + CSRF)

Must run rebase build before rebase start.


rebase ssg

Pre-renders static routes to HTML files.

bash
rebase ssg

SSG renders all routes without dynamic segments. For dynamic routes, export generateStaticParams from the page:

ts
// app/posts/[slug]/page.tsx
export async function generateStaticParams() {
  const posts = await db.posts.findMany({ select: { slug: true } });
  return posts.map((p) => ({ slug: p.slug }));
}

rebase test

Runs tests with Vitest.

bash
rebase test
rebase test --watch
rebase test --ui
FlagDefaultDescription
--watchfalseRe-run tests on file changes
--uifalseOpen the Vitest UI in the browser

You can also pass file paths to run a subset of tests:

bash
rebase test src/utils.test.ts

rebase info

Prints the route manifest, server functions, and boundary violations for the current project.

bash
rebase info

Output includes:

  • Route manifest — all discovered routes, their kind (page / api / layout), and SSR status
  • Server functions — every defineServerFn export and its generated POST endpoint
  • Boundary violations — client files that illegally import server modules at runtime

Global flags

FlagShortDescription
--cwd <path>-CSet the project root — useful in monorepos
--help-hShow help
--version-vShow version

--cwd is resolved relative to the directory where the CLI is invoked, so both absolute and relative paths work:

bash
# From the monorepo root
rebase dev --cwd apps/marketing
rebase build -C apps/dashboard
rebase start --cwd /absolute/path/to/app

Environment variables

VariableCommandsDescription
PORTdev, startHTTP port
HOSTdev, startBind address
NODE_ENVAlldevelopment in dev, production in start
PUBLIC_URLstart, ssgCanonical base URL for sitemap + CSRF cookie
REBASE_TYPECHECKbuildSet to 0 to skip typecheck (same as --skip-typecheck)

Programmatic API

The CLI commands are also exported as functions for use in custom scripts:

ts
import { build, dev, ssg } from "rebasejs/commands";

await build({ cwd: process.cwd(), mode: "ssr", analyze: false });
await ssg({ cwd: process.cwd() });

Released under the MIT License.