Validating and typing environment variables at startup so misconfig fails fast, not at 2 a.m.
Overview
Declare a schema, validate process.env once at boot, and get a typed frozen object. Missing or malformed vars throw one clear error before the app serves traffic. A zero-dep t3-env / envalid alternative.
Install
$ npm install @lacspace/env
Quick example
@lacspace/envts
createEnv({ PORT: port({ default: 3000 }) }).PORT
Returns 3000 (number)
Tips
Define the schema once; `createEnv()` returns a typed, frozen object and aggregates all errors.
Use it in both server and build steps to catch missing vars early.
Zero-dependency and isomorphic — safe to import on the server, in the browser, on the edge and in React Native. It tree-shakes, so you only ship what you import.
Looking for the complete API and more examples? The npm page and GitHub README carry the full reference — or grab the PDF.