JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3196
  • Score
    100M100P100Q115388F
  • License MIT

Typesafe environment variables parsing and validation with ArkType

Package Exports

  • arkenv

Readme

arkenv - Typesafe Environment Variables
Tests Status Bundle Size Total Downloads Dependency Count Powered By ArkType

Installation

npm
npm install arkenv arktype
pnpm
pnpm add arkenv arktype
Yarn
yarn add arkenv arktype
Bun
bun add arkenv arktype

Quickstart

[!TIP] Find more examples in the examples directory.

import { createEnv } from 'arkenv';

const env = createEnv({
  HOST: "string.host", // valid IP address or localhost
  PORT: "number.port", // valid port number (0-65535)
  NODE_ENV: "'development' | 'production' | 'test'",
});

// Automatically validate and parse process.env
// TypeScript knows the ✨exact✨ types!
console.log(env.HOST);     // (property) HOST: string
console.log(env.PORT);     // (property) PORT: number
console.log(env.NODE_ENV); // (property) NODE_ENV: "development" | "production" | "test"

Features

  • 🔒 Typesafe: Full TypeScript support with inferred types
  • 🚀 Runtime validation: Catch missing or invalid environment variables early
  • 💪 Powered by ArkType: Leverage ArkType's powerful type system
  • 🪶 Lightweight: Only a single dependency (5.6 kB)
  • Fast: Optimized for performance with minimal overhead

Documentation

For detailed documentation and examples, please visit our documentation site.

Plugins

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for more information.

Thanks / Inspiration

Find projects and people who helped or inspired the creation of ArkEnv in THANKS.md. Thank you 🙏