Runtime tiers and Node
See which runtimes RelKit supports, build your production server for Node, and run your HTTP tests against it.
RelKit runs on Bun or on Node LTS: you can create, develop and build an app with either, and when you build, you choose the runtime the production server and its container image run on.
Runtime tiers
| Tier | Runtimes | What is supported |
|---|---|---|
| Tier 1 | Bun >=1.3.10, Node 22 (>=22.13.0) and 24 |
The production server: HTTP, WebSockets and static files, with the Redis, Sentry and SQLite clients |
| Tier 2 | Cloudflare Workers (Labs) | HTTP, with jobs, events and schedules in an external Postgres and realtime on a Durable Object |
| Labs | Anything else | Not tested. It may work, but no test covers it |
Each package’s engines field lists the runtimes it supports. These still need Bun on your
machine or in CI:
@relkit/testing’s in-process test application, whichbun testruns, so the generatedtestscript still runsbun test;@relkit/aws, whose Valkey cache client uses Bun’s Redis client.
Build for Cloudflare Workers
relkit build --runtime workers writes a Workers bundle to .relkit/build/server/index.js. Its
fetch, queue and scheduled handlers activate the server once per isolate, without a listener,
a filesystem or a background loop; it needs the nodejs_compat compatibility flag, and public/ is
served by Workers static assets. relkit start refuses a Workers build: run it with wrangler dev,
or deploy it with the Cloudflare guide, which also lists the
providers that run on Workers. The nightly runtime matrix runs the api template’s HTTP tests
against the Workers bundle in workerd.
Create and develop on Node
create-relkit installs with the package manager that started it, and the generated scripts call
relkit, which runs on the same runtime:
npx create-relkit my-app
cd my-app
npm run dev
With pnpm, run pnpm dlx create-relkit my-app, then pnpm run dev; the project’s
pnpm-workspace.yaml lets esbuild run its install script. A project you run with bun run
stays on Bun even when Node is installed. Pass --package-manager bun|npm|pnpm to choose one yourself. On Node, relkit runs your TypeScript sources through
esbuild (types are removed, not checked; the parallel type-check still reports type errors), and
relkit build bundles with esbuild and builds for Node unless you pass --runtime bun.
Pre-setup
Start with an app you can already build, such as the api template,
and install Node 22.13 or later, or Node 24. Check the version:
node --version
Build and run on Node
Build the server for Node
bun run check
bun run relkit build --runtime nodeThe server in .relkit/build/server/index.js now listens through Node’s HTTP server, and
.relkit/build/manifest.json records "runtime": "node". Without --runtime, relkit build
builds for the runtime relkit runs on: Bun under Bun, Node under Node.
Start it with Node
NODE_ENV=production PORT=3000 node .relkit/build/server/index.jsNode reads no .env files, so export the variables your app needs before you start it. Open
http://127.0.0.1:3000/_relkit/v1/health/ready and expect "status":"ready".
Run your HTTP tests against the running server
In a second terminal, point your route tests at the server:
RELKIT_TEST_SERVER_URL=http://127.0.0.1:3000 bun test tests/integrationWith RELKIT_TEST_SERVER_URL set, createTestApplication sends testApp.http requests to that
server instead of starting the app in the test process. Requests without an Origin header get the
server’s own, as a browser on your app would send. Members that need the in-process app, such as
testApp.fakes, throw in this mode, so run unit tests without it.
Build a Node container image
bun run relkit build --runtime node
docker build -t my-app:node .relkit/build
docker run --rm -p 127.0.0.1:3000:3000 my-app:node
The Dockerfile has two stages: the pinned Bun image installs the production dependencies, and the
pinned node:24 image runs node server/index.js as the node user. Bun does the install
because it applies the dependency patches RelKit selects, which npm does not support.
Integrations on Node
-
Redis (
@relkit/redis) usesioredison Node and Bun’s built-in client on Bun. Both connect once, never retry a failed command and keep no offline queue. -
Sentry (
@relkit/sentry) loads@sentry/nodeon Node and@sentry/bunon Bun. Install both;relkit add sentrydoes. -
Databases with Drizzle: open the database with the client of its dialect from
@relkit/drizzle. Each one loads only the driver of the runtime it runs on:Dialect Function Import from Bun Node SQLite openSqliteDatabase@relkit/drizzle/sqlitebun:sqlitenode:sqlitePostgreSQL openPostgresDatabase@relkit/drizzle/pgBun SQL client pgMySQL openMysqlDatabase@relkit/drizzle/mysqlBun SQL client mysql2relkit add databasewrites a service that uses them and addspgormysql2to the dependencies, so the same service runs on both runtimes:
import { defineDrizzleService } from "@relkit/drizzle";
import { openPostgresDatabase } from "@relkit/drizzle/pg";
import * as schema from "./schema/index.js";
export default defineDrizzleService({
schema,
client: ({ env }) => {
const url = env.DATABASE_URL;
if (!url) throw new Error("DATABASE_URL is required");
return openPostgresDatabase(url);
},
dispose: (database) => database.$client.end(),
});
A SQLite database is closed with database.$client.close() instead. Node 22 and 24 print an
ExperimentalWarning the first time node:sqlite loads. A service written by an earlier release
imports drizzle-orm/bun-sql or bun:sqlite; replace that import and the drizzle(...) call with
the function above, and on Node install pg or mysql2.
Limits on Node
- Node’s HTTP server sets no request body limit of its own. RelKit’s
server.maxBodyBytessetting still rejects larger bodies with413. relkit devon Node starts a new server generation for every change, because Node cannot drop an evaluated module the way Bun’s in-process reload does. A reload takes about a second.relkit startruns the server on the runtime its build records, Bun unless the build says Node.- npm applies no dependency patches, so RelKit does not declare the Drizzle declaration repair in
an npm project and says so when it skips it; the repair changes type declarations only. Bun reads
it from
patchedDependenciesinpackage.json, pnpm frompnpm-workspace.yaml. An npm project approves esbuild’s install script inallowScripts, the fieldnpm approve-scriptswrites.