npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@geenius/env

v0.1.0

Published

Geenius Env — Type-safe environment variable validation with import.meta.env / process.env / Deno.env adapters

Downloads

101

Readme

@geenius/env

Type-safe environment variable validation and access for Geenius packages. @geenius/env is a framework-agnostic utility package backed by Zod schemas and structured Geenius errors.

Install

pnpm add @geenius/env zod

zod is a peer dependency. Source packages in this repository keep local Geenius package dependencies as link: references until publish-day range refresh.

Usage

import { createEnvValidator, validateEnv } from '@geenius/env'
import { z } from 'zod/v4'

const env = validateEnv({
  API_URL: z.string().url(),
  PORT: z.coerce.number().int().positive().default(3000),
})

const validateServerEnv = createEnvValidator(
  {
    API_KEY: z.string().min(1),
    RETRIES: z.coerce.number().int().default(3),
  },
  { throw: true }
)

const serverEnv = validateServerEnv({
  env: {
    API_KEY: 'local-secret',
  },
})

Runtime env sources are selected in this order: Vite or browser import.meta.env, Node process.env, Deno Deno.env.toObject(), then an empty object. Every API also accepts an explicit env source for tests and adapters.

API Reference

| Export | Purpose | | --- | --- | | env(schema, config?) | Strict validation wrapper that throws on invalid or missing values. | | optionalEnv(schema, config?) | Non-throwing validation that returns only valid values. | | validateEnv(schema, config?) | Validates an env source with Zod and returns typed output. | | createEnvValidator(schema, config?) | Builds a reusable validator with a cached schema snapshot. | | loadEnv(path, options?) | Loads dotenv files with quote, escape, comment, and export support. | | getEnv(key, ...) | Reads one value with optional default and Zod validation overloads. | | hasEnv(key, options?) | Checks value presence, with configurable empty-string handling. | | requireEnv(keyOrKeys, options?) | Returns one required value or asserts that a list exists. | | getEnvs(keys, options?) | Reads a typed record for multiple keys. | | parseEnvJson(key, default?, options?) | Parses JSON-encoded values. | | parseEnvBool(key, default?, options?) | Parses true and false token sets. | | parseEnvNumber(key, default?, options?) | Parses finite numbers with optional min and max bounds. | | parseEnvList(key, default?, options?) | Parses separated string lists. | | EnvironmentValidationError | Validation failure with Zod issue context. | | MissingEnvironmentVariableError | Required key failure with missing key context. | | InvalidEnvironmentVariableError | Single-key parse or validation failure. |

Variants

@geenius/env has one framework-agnostic implementation under packages/env. It has no UI variants, DB variants, Storybook apps, visual tests, or accessibility stories.

Testing

pnpm type-check
pnpm test
pnpm test:contracts
pnpm lint

pnpm test builds the package, runs the env-core unit tests, and runs root contract tests for the exports map, emitted declarations, and packed tarball consumer smoke.

Documentation

The public authority doc is .docs/DOCS/PACKAGES/ENV.md. Requirements and shipped scope are tracked in .docs/PRDS/packages/PACKAGE_ENV_PRD.md, .docs/PLANS/packages/env/PLAN.md, and .docs/FEATURES/packages/env/FEATURES.md.

License

FSL-1.1-Apache-2.0. See LICENSE.