# env

Validated environment contracts: responsibilities, supported exports and extension points.

## Purpose [#purpose]

Separate server, web, email and MCP resource entries validate their own configuration. Server secrets are parsed with Zod through the env helpers. Public web variables are intentionally limited.

## Public exports [#public-exports]

| Subpath          | Target                  |
| ---------------- | ----------------------- |
| `./server`       | `./src/server.ts`       |
| `./mcp-resource` | `./src/mcp-resource.ts` |
| `./web`          | `./src/web.ts`          |
| `./email`        | `./src/email.ts`        |

These paths come from `packages/env/package.json`. A `.` entry is the package root. Conditional targets distinguish platform or type resolution; consumers should import the subpath, not its source file.

## How to extend [#how-to-extend]

Add a variable to its correct contract and setup/deploy path. Never add a secret to a VITE\_ contract. Test missing, blank and malformed values; preserve existing credentials when rerunning setup.

Read the [validated environment contracts guide](/docs/development/environments) for the full flow.

## Key files [#key-files]

- [`packages/env/package.json`](https://github.com/CarlosZiegler/template-cloudflare/blob/main/packages/env/package.json)

