[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/core](../../README) / [index](../README) / startZerotal

# Function: startZerotal()

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

Defined in: [command/startZerotal.ts:34](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/command/startZerotal.ts#L34)

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`](../classes/Application); \}\>

### options?

[`StartZerotalOptions`](../interfaces/StartZerotalOptions) = `{}`

## Returns

`Promise`\<`void`\>

## Example

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