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

@coreify/env

v0.1.0

Published

Type-safe, minimal, and developer-first environment management for modern apps and CLIs.

Readme

@coreify/env

Type-safe, minimal, and developer-first environment management for modern Node apps and CLIs.

Installation

npm install @coreify/env

Quick Start

import { boolean, createEnv, enumType, number, string } from "@coreify/env";

export const env = createEnv({
  PORT: number().default(3000),
  DATABASE_URL: string().url(),
  NODE_ENV: enumType(["development", "production", "test"]),
  DEBUG: boolean().optional()
});
env.PORT;
env.DATABASE_URL;
env.NODE_ENV;
env.DEBUG;

Schema API

string();
number();
boolean();
enumType(["development", "production", "test"]);
string().optional();
string().default("value");
number().min(1).max(65535);
string().regex(/^app_/u);
string().url();

Server / Client Split

import { createEnv, defineConfig, string } from "@coreify/env";

export const env = createEnv({
  server: {
    DATABASE_URL: string()
  },
  client: {
    PUBLIC_API_URL: string().url()
  }
});

env.server.DATABASE_URL;
env.client.PUBLIC_API_URL;

Client keys must use the configured public prefix. The default prefix is PUBLIC_.

Supported Env Files

@coreify/env loads these files automatically, in order:

  1. .env
  2. .env.{mode}
  3. .env.local

Pass mode to target files like .env.development or .env.production.

Set ci: true to skip .env.local in CI pipelines.

.env.example Validation

If .env.example exists, required keys are validated automatically. You can control that behavior:

createEnv(schema, {
  validateExample: "off"
});

createEnv(schema, {
  validateExample: "required"
});

You can also validate manually:

import { validateExampleFile } from "@coreify/env";

validateExampleFile(schema, {
  cwd: process.cwd()
});

Generate or sync example files directly:

import { generateExampleFile, syncExampleFile } from "@coreify/env";

generateExampleFile(schema, {
  cwd: process.cwd()
});

syncExampleFile(schema, {
  cwd: process.cwd()
});

generateExampleFile() creates a schema-driven example file. syncExampleFile() rewrites the example file from the current schema while preserving existing values for matching keys, and removes keys that are no longer present in the schema.

Error Output

❌ Invalid environment variables:

- DATABASE_URL is missing
- PORT must be a number (received: "abc")
- NODE_ENV must be one of: development | production | test

💡 Fix your .env file or environment variables.

Advanced Options

createEnv(schema, {
  envFile: true,
  strict: true,
  prefix: "PUBLIC_",
  runtimeEnv: process.env
});

Supported options:

  • envFile: true, false, or env-file options like cwd, mode, files, ci
  • file: custom .env.example path for validation, generation, sync, and CLI flows
  • runtimeEnv: custom runtime source, useful for tests and adapters
  • strict: enables public-prefix checks and unknown public-key detection for split schemas
  • prefix: public client prefix, defaults to PUBLIC_
  • validateExample: "off" | "if-present" | "required"

CLI

The built-in CLI is Node-based and loads config files via local module import.

Create a config file:

// coreenv.config.mjs
import { defineConfig, number, string } from "@coreify/env";

export default defineConfig({
  schema: {
    PORT: number().default(3000),
    DATABASE_URL: string()
  }
});

Then run:

coreenv check
coreenv example:generate
coreenv example:sync
coreenv doctor

Useful flags:

  • --config <path>
  • --cwd <path>
  • --file <path>
  • --mode <name>
  • --prefix <value>
  • --ci
  • --no-env-file
  • --loose
  • --dry-run