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

***

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

# Variable: App

> `const` **App**: `object`

Defined in: [facade/facades/App.ts:49](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/facade/facades/App.ts#L49)

Static facade for the application container.

## Type Declaration

### container

#### Get Signature

> **get** **container**(): [`Container`](../classes/Container)

The live IoC container of the running application.

##### Returns

[`Container`](../classes/Container)

### instance()

> `readonly` **instance**(): [`Application`](../classes/Application)

The running [Application](../classes/Application) instance.

#### Returns

[`Application`](../classes/Application)

### environment()

> `readonly` **environment**(): `Environment`

The runtime environment: "web" | "console" | "worker" | "test" | "repl".

#### Returns

`Environment`

### isProduction()

> `readonly` **isProduction**(): `boolean`

Whether the configured `app.env` is a production environment.

#### Returns

`boolean`

### isLocal()

> `readonly` **isLocal**(): `boolean`

Whether the configured `app.env` is a local/development environment.

#### Returns

`boolean`

### make()

> `readonly` **make**\<`T`\>(`token`, `consumer?`): `Promise`\<`T`\>

Resolve a binding — or auto-wire a class via its `@inject()`
metadata — from the container asynchronously. This is the primary
resolution method.

#### Type Parameters

##### T

`T`

#### Parameters

##### token

[`BindingToken`](../type-aliases/BindingToken)\<`T`\>

##### consumer?

`unknown`

#### Returns

`Promise`\<`T`\>

### makeSync()

> `readonly` **makeSync**\<`T`\>(`token`): `T`

Resolve a binding synchronously. Only works for value bindings and
already-resolved singletons; throws otherwise. Prefer [App.make](#make).

#### Type Parameters

##### T

`T`

#### Parameters

##### token

[`BindingToken`](../type-aliases/BindingToken)\<`T`\>

#### Returns

`T`

### build()

> `readonly` **build**\<`T`\>(`ctor`): `Promise`\<`T`\>

Construct a class by auto-wiring its dependencies, ignoring any registered
binding for that token. Returns a brand-new instance every call.

#### Type Parameters

##### T

`T`

#### Parameters

##### ctor

(...`args`) => `T`

#### Returns

`Promise`\<`T`\>

### tryMake()

> `readonly` **tryMake**\<`K`\>(`token`): [`ContainerBindings`](../interfaces/ContainerBindings)\[`K`\] \| `undefined`

Resolve a named binding without throwing — returns `undefined` when the
token is not registered or cannot be resolved synchronously.

#### Type Parameters

##### K

`K` *extends* keyof [`ContainerBindings`](../interfaces/ContainerBindings)

#### Parameters

##### token

`K`

#### Returns

[`ContainerBindings`](../interfaces/ContainerBindings)\[`K`\] \| `undefined`

### bound()

> `readonly` **bound**(`token`): `boolean`

Whether a token is registered in the container.

#### Parameters

##### token

[`BindingToken`](../type-aliases/BindingToken)

#### Returns

`boolean`

### bind()

> `readonly` **bind**\<`T`\>(`token`, `factory`): [`Container`](../classes/Container)

Register a transient binding — the factory runs on every resolution.

#### Type Parameters

##### T

`T`

#### Parameters

##### token

[`BindingToken`](../type-aliases/BindingToken)\<`T`\>

##### factory

[`Factory`](../type-aliases/Factory)\<`T`\>

#### Returns

[`Container`](../classes/Container)

### singleton()

> `readonly` **singleton**\<`T`\>(`token`, `factory`): [`Container`](../classes/Container)

Register a singleton binding — resolved once and cached for the process lifetime.

#### Type Parameters

##### T

`T`

#### Parameters

##### token

[`BindingToken`](../type-aliases/BindingToken)\<`T`\>

##### factory

[`Factory`](../type-aliases/Factory)\<`T`\>

#### Returns

[`Container`](../classes/Container)

### scoped()

> `readonly` **scoped**\<`T`\>(`token`, `factory`): [`Container`](../classes/Container)

Register a request-scoped binding — resolved once per request scope.

#### Type Parameters

##### T

`T`

#### Parameters

##### token

[`BindingToken`](../type-aliases/BindingToken)\<`T`\>

##### factory

[`Factory`](../type-aliases/Factory)\<`T`\>

#### Returns

[`Container`](../classes/Container)

### value()

> `readonly` **value**\<`T`\>(`token`, `instance`): [`Container`](../classes/Container)

Register an already-constructed value under `token`.

#### Type Parameters

##### T

`T`

#### Parameters

##### token

[`BindingToken`](../type-aliases/BindingToken)\<`T`\>

##### instance

`T`

#### Returns

[`Container`](../classes/Container)

### alias()

> `readonly` **alias**(`from`, `to`): [`Container`](../classes/Container)

Make resolving `from` resolve `to` instead.

#### Parameters

##### from

`unknown`

##### to

`unknown`

#### Returns

[`Container`](../classes/Container)

### forget()

> `readonly` **forget**(`token`): `boolean`

Remove a binding. Returns `true` if a binding existed for the token.

#### Parameters

##### token

[`BindingToken`](../type-aliases/BindingToken)

#### Returns

`boolean`

## Example

```ts
// Auto-wire a service class (resolves its @inject() graph):
const users = await App.make(UsersService);

// Resolve a named binding:
const events = await App.make("events");

// Register during boot (bootstrap/app.ts or a provider):
App.singleton(Clock, () => new SystemClock());
```
