Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / index / startZerotal

Function: startZerotal()

startZerotal(loadApp, options?): Promise<void>

Defined in: command/startZerotal.ts:34

Boot and run the Zerotal CLI for an app.

loadApp must dynamically import the app's bootstrap module (e.g. () => import("./bootstrap/app")). Passing a thunk rather than the app itself is deliberate and load-bearing:

  • it guarantees APP_ENV is set (from the command) before the app module evaluates, since ES imports are hoisted; and
  • the literal import("./bootstrap/app") stays statically analysable, so bun build --compile bundles the app into the production binary.

Parameters

loadApp

() => Promise<{ default: Application; }>

options?

StartZerotalOptions = {}

Returns

Promise<void>

Example

// zt.ts
import { startZerotal } from "@zerotal/core";
await startZerotal(() => import("./bootstrap/app"));