Runtime / 05

Edge Runtime and API

@zolekit/core splits build-time Node APIs from zero-Node edge/browser entrypoints verified during every build:

Entrypoint Environment Capabilities
@zolekit/core Any JS/TS Config helpers (defineConfig, defineCollection, defineSingle, presets)
@zolekit/core/api Node >=24 runBuild, runLint, runDoctor, runStatus, runSearch, runExport, createWorkspace
@zolekit/core/reader Edge / Worker / Browser createReader, memoryStorage, fetchStorage, tieredStorage
@zolekit/core/writer Edge / Worker / Node createWriter with inspectable WritePlan receipts
@zolekit/core/search Edge / Worker / Browser restoreIndexFromJson, querySearchIndex, createSearchRouteHandler

Edge content reader

createReader(config, storage) validates content from any Storage implementation (fetchStorage, memoryStorage, nodeStorage) and applies configured locale fallback chains:

import { createReader, fetchStorage } from "@zolekit/core/reader";

import { docsSchema } from "./schemas/docs";

const reader = createReader(
  {
    collections: [{ name: "docs", dir: "content/docs", schema: docsSchema }],
    i18n: { enabled: true, defaultLocale: "en", fallback: { "zh-CN": "en" } },
  },
  fetchStorage({ baseUrl: "https://zole.dev" })
);

const entry = await reader.collections.docs.read("quickstart", {
  locale: "zh-CN",
});

Full-text search in workers or browsers

Persist .zole/search-index.json during zole build, serve it as a static asset or KV/R2 object, and restore it cleanly in a Worker or browser bundle:

import { querySearchIndex, restoreIndexFromJson } from "@zolekit/core/search";

const res = await fetch("/search-index.json");
const index = await restoreIndexFromJson(await res.text());
const hits = await querySearchIndex(index, { query: "defineCollection" });

For API endpoints, createSearchRouteHandler({ indexUrl }) exposes a Web Standard Request -> Response handler compatible with Cloudflare Workers and Fetch runtimes.

Type a command, config option, or guide title.