Bootstrap
zelavis bootstrap adds Zelavis endpoints to an existing framework app.
The command is interactive by default and asks for runtime adapter settings.
Use --yes with explicit flags for CI, templates, or agent-driven setup.
React Router
Section titled “React Router”React Router bootstrap targets React Router 7 Framework Mode apps:
pnpm dlx @zelavis/cli bootstrap react-routerNon-interactive example:
zelavis bootstrap react-router --adapter node --yesGenerated files:
app/lib/zelavis.server.tsapp/routes/zelavis.$.tsIf app/routes.ts exists, the CLI also tries to add:
route("zelavis/*", "routes/zelavis.$.ts")The generated resource route forwards loaders and actions directly to
zelavis.fetch(request). React Router already uses standard Web
Request and Response objects, so no framework wrapper is needed.
Next.js App Router
Section titled “Next.js App Router”App Router bootstrap creates a fetch-native route handler:
pnpm dlx @zelavis/cli bootstrap nextjs --router appNon-interactive example:
zelavis bootstrap nextjs --router app --adapter node --yesGenerated files:
lib/zelavis.server.tsapp/zelavis/[[...path]]/route.tsThe route handler exports the common HTTP method handlers and forwards the
standard Web Request to Zelavis.
Next.js Pages Router
Section titled “Next.js Pages Router”Pages Router bootstrap creates an API route and keeps the public mount at
/zelavis through a Next.js rewrite:
pnpm dlx @zelavis/cli bootstrap nextjs --router pagesNon-interactive example:
zelavis bootstrap nextjs --router pages --adapter node --yesGenerated files:
lib/zelavis.tspages/api/zelavis/[[...path]].tsnext.config.tsThe API route uses nextjsPagesRouterHandler(...) from zelavis/nextjs/pages
because the Pages Router API shape is not fetch-native. The generated API route
disables the default body parser so Zelavis can read the request stream.
If a Next config already exists, the CLI does not rewrite it automatically unless it can detect an existing Zelavis rewrite. Add this rewrite manually when the CLI prints a warning:
{ source: "/zelavis/:path*", destination: "/api/zelavis/:path*",}Adapter Selection
Section titled “Adapter Selection”The bootstrap command asks where the app will run because the generated
zelavis runtime module imports the selected environment adapter.
Supported adapters:
nodebunReact Router and Next.js bootstrap support the self-hosted runtime adapters listed above.
Options
Section titled “Options”zelavis bootstrap react-router [--adapter <adapter>] [--yes] [--cwd <path>]zelavis bootstrap nextjs [--router app|pages] [--adapter <adapter>] [--yes] [--cwd <path>]Options:
--adapter <adapter> Select node or bun.--router <router> Select app or pages for Next.js.--yes, -y Use defaults and skip prompts.--cwd <path> Project directory. Defaults to the current directory.--help, -h Show help.Defaults in non-interactive mode:
react-router adapter: nodenextjs app adapter: nodenextjs pages adapter: nodeIdempotency
Section titled “Idempotency”The CLI creates files only when they do not already exist. Existing runtime modules and route files are skipped so local edits are not overwritten.
For route config files, the CLI performs small conservative edits. If it cannot update a config safely, it prints the change to make manually.