fusion-env
Typed environment-variable validation for the Fusion stack — a thin
@t3-oss/env-core + Zod wrapper that
parses and validates a runtime environment into a fully-typed object.
Source-published (Model A): consumers bundle the TypeScript directly.
Validate once, typed everywhere
You call createAppEnv(process.env) once at boot. It validates the raw
environment against a Zod schema and hands back a typed object — so the rest of
the app reads env.SERVER_URL (a string | undefined) instead of poking at
process.env.SERVER_URL (a string | undefined that lied to you). Misconfigured
values fail fast, at startup, with a clear error — not deep in a request three
hours later.
Two things come for free from @t3-oss/env-core:
- Server / client separation —
VITE_-prefixed vars are the only ones a browser bundle may read; server secrets can't leak into client code. - Empty strings are
undefined— a blankSERVER_URL=is treated as "not set" rather than an invalid value.
Install
Published to GitHub Packages under the @tikab-interactive scope, so an
.npmrc with a read:packages token is required:
@tikab-interactive:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}bun add @tikab-interactive/fusion-env @t3-oss/env-core zod@t3-oss/env-core and zod are peer dependencies — install them in the
consuming app.
Next steps
- The schema — every variable fusion-env validates, and how the server/client split works.
- Usage — wiring
createAppEnvinto your app and reading typed values.