property FromConfigOptions.env

The environment to read configuration from, instead of the platform's.

Required on Cloudflare Workers, and the only way this factory works there: Workers bindings arrive as the env argument of the fetch handler, never as a process-wide global, so runtime services built outside a request report an EMPTY environment. Without this the application composes from no configuration at all — and a resolver calling getOrThrow then fails on the first request and, because the boot promise is memoised, on every request after it.

Omit it on Node, Deno, and Bun: those expose the environment process-wide, and the detected runtime already reads it.

Non-string values are ignored, so a Workers env carrying KV, D1, or R2 bindings alongside its string variables can be passed verbatim.

Explicitly | undefined under exactOptionalPropertyTypes: callers forward an optional binding straight through ({ env } where env may be undefined), which would not otherwise type-check against an optional property. The generated Workers entry does exactly that on all four targets.

Examples

A Cloudflare Workers entry

export default {
  async fetch(request: Request, env: Record<string, unknown>): Promise<Response> {
    const app = await createFullStackAppFromConfig(build, { env });
    await app.start();
    return await app.fetch(request);
  },
};

Type

Readonly<Record<string, unknown>> | undefined

Usage

import { type FromConfigOptions } from "starters/full-stack-starter/src/index.ts";