NextRush

Runtime Adapters

Connect NextRush to Node.js, Bun, Deno, or Edge runtimes

Adapters connect your NextRush application to the underlying runtime's HTTP server.

Why Adapters?

NextRush's core is runtime-agnostic. The Application class doesn't know about HTTP servers—it only knows about middleware and context objects.

Adapters bridge this gap:

Loading diagram...

Each adapter:

  1. Creates a platform-specific request handler
  2. Converts native requests to Context objects
  3. Converts context responses back to native responses
  4. Manages server lifecycle (start, stop, graceful shutdown)

Node.js Included by Default

The Node.js adapter is bundled with the nextrush meta package. Install platform-specific adapters separately only when targeting Bun, Deno, or Edge runtimes.

Available Adapters

PackageRuntimeInstall Separately?
@nextrush/adapter-nodeNode.jsIncluded in nextrush
@nextrush/adapter-bunBunYes
@nextrush/adapter-denoDenoYes
@nextrush/adapter-edgeEdge (Cloudflare, Vercel)Yes

Quick Comparison

Each runtime uses a different adapter import. The application logic stays the same.

import { createApp, createRouter, listen } from 'nextrush';

const app = createApp();
const router = createRouter();

router.get('/', (ctx) => ctx.json({ runtime: 'node' }));

app.route('/', router);
await listen(app, 3000);
import { createApp } from '@nextrush/core';
import { createRouter } from '@nextrush/router';
import { serve } from '@nextrush/adapter-bun';

const app = createApp();
const router = createRouter();

router.get('/', (ctx) => ctx.json({ runtime: 'bun' }));

app.route('/', router);
serve(app, { port: 3000 });
import { createApp } from '@nextrush/core';
import { createRouter } from '@nextrush/router';
import { serve } from '@nextrush/adapter-deno';

const app = createApp();
const router = createRouter();

router.get('/', (ctx) => ctx.json({ runtime: 'deno' }));

app.route('/', router);
await serve(app, { port: 3000 });
import { createApp } from '@nextrush/core';
import { createRouter } from '@nextrush/router';
import { createHandler } from '@nextrush/adapter-edge';

const app = createApp();
const router = createRouter();

router.get('/', (ctx) => ctx.json({ runtime: 'edge' }));

app.route('/', router);

export default {
  fetch: createHandler(app),
};

Common API

All adapters export similar functions:

FunctionDescription
serve(app, options)Start HTTP server
listen(app, port)Shorthand with default logging
createHandler(app)Create request handler function

Choosing an Adapter

RuntimeOften chosen when
Node.jsYou need the broadest ecosystem and existing Node deployments
BunYou want a fast JS runtime with strong Node compatibility where supported
DenoYou want permissions, TypeScript-first tooling, or Deno Deploy
EdgeYou deploy to isolates or regional workers with fetch-only I/O

Runtime Capabilities

Different runtimes have different capabilities:

CapabilityNode.jsBunDenoEdge
File System
WebSocket
Native Fetch
Worker Threads⚠️
Node.js APIs⚠️
Cold start feelTypicalOften lowTypicalOften lowest (host-dependent)

Same Code, Any Runtime

Write your application logic once:

app.ts
import { createApp } from '@nextrush/core';
import { createRouter } from '@nextrush/router';

export const app = createApp();
export const router = createRouter();

router.get('/health', (ctx) => {
  ctx.json({ status: 'healthy' });
});

app.route('/', router);

Then deploy anywhere:

node.ts
import { app } from './app';
import { listen } from '@nextrush/adapter-node';
await listen(app, 3000);
bun.ts
import { app } from './app';
import { serve } from '@nextrush/adapter-bun';
serve(app, { port: 3000 });
worker.ts
import { app } from './app';
import { createHandler } from '@nextrush/adapter-edge';
export default { fetch: createHandler(app) };

Detailed Documentation

On this page