tekir
All Packages
Utilitiesv0.1.4

@tekir/env

Typed environment variable validation.

Installation

$bun add @tekir/env

Features

  • Schema-based env validation via envalid
  • Built-in validators: str, num, bool, port, url, email, json
  • Custom validators with makeValidator()
  • Readonly typed output object
  • Fails fast on missing or invalid env vars

Quick Example

TypeScript
import { defineEnv, str, num, port, bool } from '@tekir/env'

const env = defineEnv({
  NODE_ENV: str({ choices: ['development', 'production'] }),
  PORT: port({ default: 3000 }),
  DEBUG: bool({ default: false }),
})

Changelog

v0.1.4LatestSeptember 16, 2026
  • Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.3July 23, 2026
  • Package metadata now follows the shared compatible 0.1.x dependency range used by this coordinated Tekir release.
v0.1.2July 16, 2026
  • Environment schema regression coverage now verifies defaults, coercion, choices, optional values, and invalid-input failures across the public API.
v0.1.1June 13, 2026
  • defineEnv(schema, options?) now accepts envalid's CleanOptions, including a custom reporter, so you can throw on invalid env instead of having the process exit.
  • The return type now uses envalid's official CleanedEnv<T> inference, and the schema type is tied to ValidatorSpec, so invalid validator objects are caught at compile time.
  • Found and fixed with Fable.
v0.1.0April 1, 2026
  • Initial release

Other Utilities packages