PRO

SvelteKit Explicit Env Vars

A src/env.ts manifest using defineEnvVars from @sveltejs/kit/env, the import path introduced in 2.70.0 (the older @sveltejs/kit export is now deprecated). Replaces prefix-based $env/static and $env/dynamic with one declared table where every variable states its visibility, whether it is inlined at build time, a description that becomes editor hover documentation, and a Standard Schema validator that runs once at startup so a bad value fails the boot rather than the first request that needs it. Ships dependency-free Standard Schema validators for https origins, bounded integers and Postgres URLs, so env values arrive typed as number or string rather than as raw strings. Covers all four visibility and staticness combinations.

Install
npx shadcn@latest add https://ui.aryank.space/r/sveltekit-explicit-env-vars.json

Installs from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.

Visualization
env model
rename + build
string
client bundle
unknown
import { PUBLIC_STRIPE_KEY } from "$env/static/public" // oops

Visibility hangs on a naming prefix: someone renames STRIPE_SECRET to PUBLIC_STRIPE_KEY while wiring the checkout, the bundler happily inlines it, and the secret ships to every browser in the client JavaScript. The rename compiled; nothing warned.

Files

Dependencies
@sveltejs/[email protected]@standard-schema/[email protected]