@nevr-env/core
v0.2.0
Published
Type-safe environment validation with plugin system and Proxy pattern
Maintainers
Readme
@nevr-env/core
Type-safe environment validation with a plugin system, Proxy pattern, and zero required dependencies.
Install
pnpm add @nevr-env/core zodUsage
import { createEnv } from "@nevr-env/core";
import { z } from "zod";
export const env = createEnv({
server: {
DATABASE_URL: z.string().url(),
API_SECRET: z.string().min(32),
},
client: {
NEXT_PUBLIC_APP_URL: z.string().url(),
},
clientPrefix: "NEXT_PUBLIC_",
runtimeEnv: process.env,
});
// Fully typed — env.DATABASE_URL is string, env.API_SECRET is stringFeatures
- Type-safe — Full TypeScript inference from schemas, no codegen needed
- Plugin system —
createPlugin()factory for declarative env definitions - Multi-library — Works with Zod, Valibot, ArkType, or any Standard Schema
- Proxy-based — Server variables throw if accessed on the client
- Zero required deps — Core has no runtime dependencies (schema libs are optional peers)
Built-in Schema Helpers
Skip Zod entirely with lightweight built-in validators:
import { urlSchema, portSchema, booleanSchema } from "@nevr-env/core";
const env = createEnv({
server: {
API_URL: urlSchema(),
PORT: portSchema(),
DEBUG: booleanSchema(false),
},
runtimeEnv: process.env,
});Batteries-included Package
For plugins, vault, CLI, and presets, install the umbrella package instead:
pnpm add nevr-env zodEcosystem
| Package | Description |
|---------|-------------|
| nevr-env | The umbrella package — includes everything: core, plugins, presets, vault, and CLI |
| @nevr-env/cli | Interactive CLI — fix wizard, scanner, vault, schema diff, and 12 more commands |
See nevr-env on npm or the full documentation.
License
MIT — Built with obsession by the nevr-env contributors.
