Framework lifecycle
context + environment + config -> instanceMakers
The generated dependency-injection boundary for functions, endpoints, clients, servers, serializers, and infrastructure.
When to use
Use this page when implementing maker hooks, owning resources, or diagnosing startup and shutdown.
Behavior
- Generated defaults map graph elements to concrete framework constructors.
- The custom maker hook runs before invocation and may replace selected defaults.
- Independent makers run concurrently with shared cancellation after the first failure.
- Each result is stored and reused for the service lifetime.
Maker and instance lifetime
GeneratedInstall defaultsAssign every required factory.
User hookOverride makersReplace only selected factories.
StartupInvoke in parallelCreate one long-lived instance.
RunningReuse instanceMany messages call the stored object.
ShutdownRelease after drainOwnership ends after dependent work.
Maker responsibilities
- Create dependency clients and immutable collaborators.
- Validate the typed graph config passed to the maker.
- Return a function object whose hooks create per-request state.
- Leave activation and shutdown to runtime lifecycle methods.
Hooks and boundaries properties
Generated extension points and runtime-owned lifecycle boundaries.
PropertyTypeDescription
contextcancellation/deadlineCancels sibling initialization after a failure.
environmentServiceEnvironmentLogging, metrics, serde, callers, and runtime configuration.
configtyped graph configConfig for the stream, endpoint, connector, or service.
resultowned instanceLong-lived function or infrastructure object.
Lifecycle outline
customMakersInit(ctx) {
makers.<function_name> = async (ctx, env, config) => new CustomFunction(...);
}