Getting Started
Build fetch-style servers with middleware, invocation context, and runtime adapters.
Install
npm i @hornjs/fest
yarn add @hornjs/fest
pnpm i @hornjs/fest
bun i @hornjs/fest
deno i npm:@hornjs/fest
Quick Start
Create a server entry:
server.ts
import { serve } from "@hornjs/fest";
import { NodeRuntimeAdapter } from "@hornjs/fest/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 fest");
},
};
Then run:
npx @hornjs/fest
yarn dlx @hornjs/fest
pnpm dlx @hornjs/fest
bunx @hornjs/fest
deno run -A npm:@hornjs/fest
Or after installation, run the installed binary directly:
fest
The CLI will look for common entry names such as:
server.tsserver.mjssrc/server.tssrc/server.mjs
If your entry uses another name or extension, pass it explicitly:
fest --entry ./server.tsx --import jiti/register
Runtime Adapters
fest keeps request handling runtime-agnostic. You provide an adapter for the
host environment you want to run on.
@hornjs/fest/node@hornjs/fest/bun@hornjs/fest/deno@hornjs/fest/stream
Main Exports
import {
Server,
ServerServeEvent,
ServerCloseEvent,
ServerErrorEvent,
serve,
createContextKey,
} from "@hornjs/fest";
import { log } from "@hornjs/fest/log";
import { serveStatic } from "@hornjs/fest/static";
import { StreamRuntimeAdapter } from "@hornjs/fest/stream";
Examples
The repository includes runnable examples under examples/:
examples/basic/node.tsexamples/basic/bun.tsexamples/basic/deno.tsexamples/basic/stream.tsexamples/jsx/server.tsx