Adapter Entry Points
Zelavis has two adapter layers:
- Runtime adapters (
zelavis/adapters/*) describe the local JavaScript runtime Zelavis runs on. - Framework utilities (
zelavis/<framework>) wrapzv.fetch(request)for a specific self-hosted framework server.
Runtime adapters
Section titled “Runtime adapters”Supported runtime adapters:
zelavis/adapters/node — Node.js with better-sqlite3, local files, and local service packageszelavis/adapters/bun — Bun with bun:sqlite, local files, and local service packagesDeno is a planned runtime target.
The zelavis/adapters barrel re-exports every adapter under its canonical name
and a zelavisX alias:
import { nodeAdapter, bunAdapter, zelavisNode, zelavisBun,} from "zelavis/adapters";Typical usage:
import { Zelavis } from "zelavis";import { nodeAdapter } from "zelavis/adapters/node";
const zv = new Zelavis({ adapter: nodeAdapter() });Framework utilities
Section titled “Framework utilities”Framework utilities take a Zelavis instance and return whatever shape the
framework expects. They live at zelavis/<framework>:
zelavis/express — expressMiddleware(zv)zelavis/hono — honoMiddleware(zv)zelavis/fastify — fastifyPlugin(zv)zelavis/h3 — h3Handler(zv)zelavis/elysia — elysiaPlugin(zv)zelavis/nextjs/pages — nextjsPagesRouterHandler(zv, options?)zelavis/node — createNodeServer(zv)These are not runtime adapters. The Zelavis instance is constructed once with
its runtime adapter, and the utility only adapts request and response handling.
defineAdapter
Section titled “defineAdapter”To build a custom self-hosted runtime adapter:
import { defineAdapter } from "zelavis";
const myAdapter = defineAdapter({ name: "my-host", async resolve(_options) { return { resources: { kv: myStore, files: myStorage }, metadata: { runtime: "my-host" }, }; },});Adapters may expose service activation through resources.services. The
built-in local adapters use the runtime graph: service registry changes are
applied by the running Zelavis process when supported, or by restarting the
process when live activation is unavailable.