Cerial

Runtime Compatibility

Supported runtimes, module formats, CLI compatibility, and package exports for Cerial.

Cerial is published as compiled JavaScript with dual ESM and CJS output, making it compatible with Node.js, Bun, and Deno. The runtime client works identically across all three — your application code doesn't change.

Supported Runtimes

RuntimeVersionSupport Level
Node.js20+Full support (ESM and CJS)
Bun1.0+Full support (ESM)
DenoLatestVia npm: specifier

Module Formats

Cerial ships both ESM (.mjs) and CJS (.cjs) builds with TypeScript declarations:

FormatExtensionRuntimes
ESM.mjsNode.js, Bun, Deno
CJS.cjsNode.js
Types (ESM).d.mtsAll
Types (CJS).d.ctsNode.js

Node.js automatically selects the right format based on your project's type field in package.json and the import style (import vs require).

CLI Compatibility

The cerial CLI binary uses a #!/usr/bin/env node shebang, so it works with any Node.js-compatible runtime:

# All of these work:
npx cerial generate
bunx cerial generate
pnpm exec cerial generate
yarn cerial generate

The CLI is ESM-only internally, but this doesn't affect how you run it — the shebang handles execution.

Config File Format

Cerial supports two config formats:

  • cerial.config.json — Works with all runtimes. Recommended for Node.js projects.
  • cerial.config.ts — Requires a runtime with native TypeScript support (Bun, Deno, or Node.js with --experimental-strip-types).

If your project runs on Node.js without a TypeScript loader, use the JSON config format. See Configuration for details.

Deno Usage

Cerial works in Deno via the npm: specifier:

import { CerialClient } from 'npm:cerial';

const client = new CerialClient();
await client.connect({
  url: 'http://localhost:8000',
  namespace: 'main',
  database: 'main',
  auth: { username: 'root', password: 'root' },
});

Run with network permissions:

deno run --allow-net app.ts

For CLI usage in Deno projects, use npx cerial generate (requires Node.js installed) or bunx cerial generate (requires Bun installed).

Package Exports

Cerial exposes these subpath exports, each available in both ESM and CJS (except ./cli):

SubpathESMCJSDescription
cerialMain entry — client, types, utilities
cerial/parserSchema parser (AST generation)
cerial/generatorsCode generators
cerial/queryQuery builders
cerial/clientRuntime client internals
cerial/utilsUtility classes (CerialId, CerialUuid, etc.)
cerial/typesShared TypeScript types
cerial/cliCLI internals (ESM-only)

The ./cli subpath is ESM-only because it depends on citty, which is an ESM-only package. This doesn't affect CLI usage — the binary works fine via npx/bunx.

On this page