Skip to content

Public API ​

API freeze target

The public surface below is the freeze target for 0.5.5. After 0.5.5, zero follows SemVer: any breaking change to a name listed here requires a two-release deprecation window (@deprecated alias kept, removal in the following minor). Additions and non-breaking fixes are allowed in patch and minor releases. The authoritative source of truth is src/zero.zig.

The public import name is zero. Consumers do @import("zero") and reach every type below through it. For the type-erased interface machinery behind the backends, see Interface; for the upgrade and deprecation policy, see Upgrade policy.

Application lifecycle ​

SymbolKindPurpose
AppstructTop-level app; App.new, app.run, app.get/post/...
ContextstructPer-request context: ctx.request, ctx.response, ctx.SQL, ctx.NoSQL, ctx.KV, ctx.FileStore, ctx.pubsub, ctx.params
containerstructBackend wiring (container.datasource, container.redis, pub/sub, file stores)
loggernamespacelogger.custom — zero's stderr/stdout logger
confignamespace.env loading and typed accessors
constantsnamespaceWell-known paths, defaults, enum maps
App.addSQL, App.addPubSubmethodsRegister named SQL / pub/sub backends; look them up via ctx.GetSQL(name) / ctx.GetPubSub(name)
Context.GetSQL, Context.GetPubSub, Context.GetKVStore, Context.GetFileStore, Context.getServicemethodsNamed lookups; the default backend is unchanged on ctx.SQL / ctx.pubsub / ctx.KV / ctx.FileStore

HTTP, middleware & observability ​

SymbolKindPurpose
httpServer, handler, respondernamespacesHTTP server, dispatch, response helpers
rateLimiternamespace@import("zero").rateLimiter — in-memory/Redis rate limiting
tracz, baggage, otelnamespacesTracing, W3C baggage, OpenTelemetry bridge
metricz, metriczServernamespacesPrometheus metrics + scrape endpoint

Auth & security ​

SymbolKindPurpose
AuthProviderstructBasic / API-key / OAuth verification (AuthProvider.retrieveClaims)
jwtClaimstypeDecoded JWT claims
authznamespaceAuthorization helpers
rbacnamespaceRole-based access control

Datasources ​

SymbolKindPurpose
SQLstructUnified SQL dialect entry (ctx.SQL)
App.addSQL(name, ds) / Context.GetSQL(name)methodsNamed SQL datasources alongside the default (ctx.SQL); the wired default is also under the "default" key
Datasource (Interface)interfaceType-erased SQL backend
SQLite, DuckDB, DuckGres, ClickHouse, MySQLstructsSQL backends
Timeseries, InfluxDB, OpenTSDBstructsTime-series backends
Search, Solr, MeilistructsSearch backends
Graph, DgraphstructsGraph backend
NoSQL, Cassandra, Couchbase, MongoDB, ArangoDBstructsNoSQL backends
migration, migratenamespacesSchema migrations & seeding
App.addOutbox(opts) / outbox.enqueue(ctx, table, topic, payload)method / fnOpt-in transactional outbox: enqueue a message inside your DB transaction, a cron poller publishes pending rows to the configured pub/sub backend with a retry/attempts cap

KV, file stores & pub/sub ​

SymbolKindPurpose
KVStore (interface)interfaceKey/value store
FileStore (interface), UploadedFileinterface / typeFile storage + uploaded file
pubsub interface (Container, Subscriber, Publisher)interfaceType-erased pub/sub
App.addPubSub(name, ps) / Context.GetPubSub(name)methodsNamed pub/sub backends alongside the default (ctx.pubsub); the wired default is also under the "default" key
kafka, kafkaSubscriber, kafkaMessagenamespacesApache Kafka backend
mqtt, nats, rdz (Redis), sqs, gcppubsubnamespacesOther pub/sub backends

Service client, protobuf & websockets ​

SymbolKindPurpose
client (Client)structOutbound HTTP client with auth + circuit breaker
protobufnamespaceProtobuf encode/decode
WebSocketClient (Client)structOutbound WebSocket client

Utilities ​

SymbolKindPurpose
utilsnamespaceString/format helpers, timestamps
sysinfo (zf)namespaceHost metrics (CPU/mem/process)

Upgrade policy ​

  • 0.x.y patch: security/regression fixes only, no API change.
  • 0.x.0 minor: new backends/options, deprecations; interface-compatible.
  • 1.0.0+: semver, interface changes are majors.

Before you upgrade:

  1. Bump minimum_zig_version in your build.zig.zon to match the new zero.
  2. Read the relevant section of Release Notes for your from→to range.
  3. Run zig build test and zig build test-integration — the datasource parity tests catch dialect drift early.

Notable breaking changes are announced here, in chronological order:

  • OTel promotion — OTEL_EXPERIMENTAL was removed; OpenTelemetry is enabled by setting an OTLP endpoint (OTEL_EXPORTER_OTLP_ENDPOINT or per-signal *_ENDPOINT). Drop the experimental flag from your env.
  • Named backends — app.addSQL(name, ds) / app.addPubSub(name, ps) and ctx.GetSQL(name) / ctx.GetPubSub(name); the wired default is also under the "default" key. Code that only used ctx.SQL is unchanged.
  • Transactional outbox — app.addOutbox(opts) ships a poller; opt-in, no behavior change unless you call it.
  • Redis resilience — container.rdz.reconnect() added; the health probe heals a dead socket automatically. No API change, but Redis-dependent behavior now recovers without a restart.
  • Kafka TLS default — KAFKA_TLS_INSECURE_SKIP_VERIFY now defaults to false (cert verification on). Set it to true only if you deliberately accept unverified certs.

Deprecated symbols are kept for one minor release, logged at startup, and removed in the next minor. Pin a version and watch startup logs after upgrading. See also Migrating to 0.16.

Notes ​

  • The earlier misspellings AuthProvder, Kakfa, and onStatup were corrected to AuthProvider, container.Kafka, and onStartup. Do not reintroduce the old spellings.
  • Optional heavy backends are build flags in build.zig: -Dkafka=false and -Dduckdb=false drop librdkafka / libduckdb from the build.
  • Pin the Zig version and the zero commit you build against until 1.0; the interface may still change between minor releases.