Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / index

index

The Zerotal kernel — the IoC container, application lifecycle, HTTP router and pipeline, service providers, events, facades, and the common request helpers that every Zerotal app builds on.

@zerotal/core is the one package every app depends on. This root entry carries only the hot, cheap kernel used across the framework — Application, the Container, HttpContext, the Router, middleware, providers, events, facades, and helpers. Heavier or cohesive subsystems live behind explicit subpaths so importing the kernel never drags them in:

SubpathWhat it provides
@zerotal/core/contractsInterface-only seams packages implement and the kernel consumes (session, transaction, authenticatable user)
@zerotal/core/carbonDate/time via Carbon (pulls the Temporal polyfill)
@zerotal/core/httpOutbound HTTP client, URL building, uploads, API resources, content negotiation
@zerotal/core/viewServer-side JSX runtime + authoring helpers
@zerotal/core/envTyped environment-variable schema
@zerotal/core/configConfig manager/loader + app config shapes
@zerotal/core/securityCrypt + Hash
@zerotal/core/loggerStructured logging (Log, channels)
@zerotal/core/lockDistributed locks
@zerotal/core/commandsBuilt-in CLI commands
@zerotal/core/devDev-only build/reload tooling (owns Bun.build)
@zerotal/core/assetsAsset URL helper + versioning
@zerotal/core/healthHealth checks
@zerotal/core/metricsHTTP request metrics

Examples

Bootstrap an application

// bootstrap/app.ts
import { Application } from "@zerotal/core";
import providers from "./providers.ts";

const app = Application.create({ providers, env: "web" });
await app.start();

Define routes and a controller

import { Router } from "@zerotal/core";

Router.get("/", (ctx) => ctx.html("<h1>Hello</h1>"));
Router.get("/users/{id}", (ctx) => ctx.json({ id: ctx.params.id }));

Remarks

Zerotal runs on Bun ≥ 1.1 — Node.js is not supported. The framework uses Bun.sql, Bun.CryptoHasher, Bun.build, and other Bun-native APIs throughout.

Application lifecycle

Console

Contracts

Extension registries

HTTP

Naming & URLs

Other

env

Re-exports env


requireEnv

Re-exports requireEnv


setAppEnv

Re-exports setAppEnv


basePath

Re-exports basePath


tap

Re-exports tap


tapAsync

Re-exports tapAsync


pipe

Re-exports pipe


pipeAsync

Re-exports pipeAsync


rescue

Re-exports rescue


rescueSync

Re-exports rescueSync


data_get

Re-exports data_get


FileRouteHandler

Renames and re-exports FileHandler