Getting Started

Build web-standard servers with context-based handlers, middleware, and runtime adapters.

Install

npm i sevo

Quick Start

Create a server entry:

server.ts
import { serve } from "sevo";
import { NodeRuntimeAdapter } from "sevo/node";

serve({
  adapter: new NodeRuntimeAdapter(),
  fetch() {
    return Response.json({ hello: "world" });
  },
});

Run it with Node.js:

node --experimental-strip-types server.ts

Quick Start with CLI

Create a default entry file:

server.ts
export default {
  fetch() {
    return new Response("Hello from sevo");
  },
};

Then run:

npx sevo

Or after installation, run the installed binary directly:

sevo

The CLI will look for common entry names such as:

  • server.ts
  • server.mjs
  • src/server.ts
  • src/server.mjs

If your entry uses another name or extension, pass it explicitly:

sevo --entry ./server.tsx --import jiti/register
Read more in Using the CLI.

Runtime Adapters

sevo keeps request handling runtime-agnostic. You provide an adapter for the host environment you want to run on.

  • sevo/node
  • sevo/bun
  • sevo/deno
  • sevo/stream

Main Exports

import {
  Server,
  ServerServeEvent,
  ServerCloseEvent,
  ServerErrorEvent,
  serve,
  createContextKey,
} from "sevo";
import { log } from "sevo/log";
import { serveStatic } from "sevo/static";
import { StreamRuntimeAdapter } from "sevo/stream";

Examples

The repository includes runnable examples under examples/:

  • examples/basic/node.ts
  • examples/basic/bun.ts
  • examples/basic/deno.ts
  • examples/basic/stream.ts
  • examples/jsx/server.tsx