Runtime Adapters and Fetch-Native Hosting
Zelavis has a focused runtime adapter model:
- Runtime adapters describe the self-hosted JavaScript runtime Zelavis runs on. Today that means Node.js and Bun. Deno is planned.
The core request handler remains Web-standard: zv.fetch(request) accepts a
standard Request and returns a standard Response. That keeps the core
portable without making serverless platforms runtime targets.
Quick examples
Section titled “Quick examples”Node.js standalone HTTP server
Section titled “Node.js standalone HTTP server”import { Zelavis } from "zelavis";import { nodeAdapter } from "zelavis/adapters/node";import { createNodeServer } from "zelavis/runtimes/node";
const zv = new Zelavis({ adapter: nodeAdapter() });const server = await createNodeServer(zv);server.listen(3000);Bun fetch handler
Section titled “Bun fetch handler”import { Zelavis } from "zelavis";import { bunAdapter } from "zelavis/adapters/bun";
const zv = new Zelavis({ adapter: bunAdapter() });
Bun.serve({ port: 3000, fetch(request) { return zv.fetch(request); },});Runtime adapters
Section titled “Runtime adapters”| Adapter | Import path | Provides |
|---|---|---|
| Node.js | zelavis/adapters/node |
node:sqlite, local files, local service packages |
| Bun | zelavis/adapters/bun |
bun:sqlite, local files, local service packages |
All adapters are also re-exported from the barrel zelavis/adapters under both
their canonical names and zelavisX aliases:
import { zelavisNode, zelavisBun,} from "zelavis/adapters";Host utilities
Section titled “Host utilities”| Host | Import | Returns |
|---|---|---|
| Node HTTP server | zelavis/runtimes/node -> createNodeServer(zv) |
Promise<http.Server> |
| Bun marker | zelavis/runtimes/bun |
bun = true |
| Deno marker | zelavis/runtimes/deno |
deno = true |
Fetch-native hosts can call zv.fetch(request) directly.
SDK bundle surfaces
Section titled “SDK bundle surfaces”Browser support means SDK/client code, not running the Platform OS in a browser.
Use zelavis/sdk/browser for a browser-safe fetch client and portable
zelavis/app/db / zelavis/app/identity contracts without importing the
dashboard, runtime host utilities, or local server adapters.
import { createBrowserZelavisClient } from "zelavis/sdk/browser";
const client = createBrowserZelavisClient({ baseUrl: "https://example.com",});
await client.runtime.config();Future browser database adapters such as IndexedDB or SQLite WASM should plug into the same database driver boundary used by server adapters.
Why no serverless runtime targets
Section titled “Why no serverless runtime targets”Zelavis is intended to be the platform the operator owns. It should run on a VPS, dedicated server, container, local machine, or future Deno-compatible self-hosted environment. Managed platforms can still be deployment providers for user websites or optional provider adapters, but they are not places where the Zelavis runtime itself is expected to live.