Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d2661ad
docs: update warning syntax and add superset configuration file
yamcodes Jun 21, 2026
3a7af36
docs: add titles to callout blocks across documentation pages
yamcodes Jun 21, 2026
2a96452
[autofix.ci] apply automated fixes
autofix-ci[bot] Jun 21, 2026
5972790
docs: use remarkNpm for installation command tabs
yamcodes Jun 21, 2026
63c07e4
docs: remove 'safe' property from dev branch
yamcodes Jun 21, 2026
cde8591
docs: customize remarkNpm to use 'bun x' instead of 'bunx'
yamcodes Jun 21, 2026
78c5ad2
Revert "docs: customize remarkNpm to use 'bun x' instead of 'bunx'"
yamcodes Jun 21, 2026
4a282b9
docs: customize remarkNpm to use 'bunx' instead of 'bun x'
yamcodes Jun 21, 2026
af09333
docs: use remark-steps plugin instead of explicit <Steps> components
yamcodes Jun 21, 2026
1ad508b
docs: auto-generate options table using fumadocs-typescript
yamcodes Jun 21, 2026
3b7f761
chore: update dependency lockfile to synchronize package versions
yamcodes Jun 21, 2026
3b78d8f
docs: add twoslash autocomplete and typescript errors
yamcodes Jun 21, 2026
4d70d24
docs: hide steps from TOC and fix twoslash build error
yamcodes Jun 21, 2026
a36bf80
docs: refactor options page to use AutoTypeTable and examples
yamcodes Jun 21, 2026
fe34c68
docs: adjust callout and headings for options
yamcodes Jun 21, 2026
aee6a89
docs: update standard schema validator headers and remove redundant i…
yamcodes Jun 21, 2026
e81fe16
docs: escape square brackets in mdx step headings to fix syntax rende…
yamcodes Jun 21, 2026
4a8a75a
fix: unescape [step] tags in fix script, remove prettier-ignore worka…
yamcodes Jun 21, 2026
4aac75a
docs: use @errors for visual twoslash error display in strict layouts
yamcodes Jun 21, 2026
d8a787f
fix: add 2307 error code for twoslash virtual module resolution
yamcodes Jun 21, 2026
10bdabe
fix: use declare module to resolve path aliases in twoslash blocks
yamcodes Jun 21, 2026
e13307f
fix: inline types in declare module to avoid V8 segfault
yamcodes Jun 21, 2026
2a84a45
revert: use @noErrors + @ts-expect-error for strict layout twoslash
yamcodes Jun 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions apps/www/content/docs/arkenv/examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,9 @@ import { SiGithub as GitHub } from "@icons-pack/react-simple-icons";

Use the [ArkEnv CLI](/docs/cli) to bootstrap an example with your favorite tooling.

<Tabs items={['npm', 'pnpm', 'yarn', 'bun']}>
<Tab value="npm">
```bash
npx @arkenv/cli@latest init --example <example-name>
```
</Tab>

<Tab value="pnpm">
```bash
pnx @arkenv/cli@latest init --example <example-name>
```
</Tab>

<Tab value="yarn">
```bash
yarn dlx @arkenv/cli@latest init --example <example-name>
```
</Tab>

<Tab value="bun">
```bash
bunx @arkenv/cli@latest init --example <example-name>
```
</Tab>
</Tabs>
```npm
npx @arkenv/cli@latest init --example <example-name>
```

<include cwd>../../examples/README.md#examples</include>

Expand Down
6 changes: 5 additions & 1 deletion apps/www/content/docs/arkenv/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description: Introducing ArkEnv, an environment variable validator that stays ou
At its core, ArkEnv is a single export that creates a ready-to-use, typesafe environment variable object:

```ts twoslash
// @noErrors
import arkenv from "arkenv";

const env = arkenv({
Expand All @@ -19,7 +20,10 @@ const env = arkenv({
const host = env.HOST;
const port = env.PORT;
const nodeEnv = env.NODE_ENV;
const debugging = env.DEBUGGING;

// Type "env." to see autocomplete
const debugging = env.
// ^|
```

> ArkEnv defaults to [ArkType](https://arktype.io/) notation, the closest match to TypeScript syntax for editor-to-runtime typesafety. You can also use any [Standard Schema](https://standardschema.dev/schema) validator, including Zod, Valibot, and Typia.
Expand Down
28 changes: 3 additions & 25 deletions apps/www/content/docs/arkenv/integrations/ai/skills.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,9 @@ Skills give AI assistants like Claude Code on-demand procedural knowledge about

## Installation

<Tabs items={['npm', 'pnpm', 'yarn', 'bun']}>
<Tab value="npm">
```bash
npx skills add yamcodes/arkenv
```
</Tab>

<Tab value="pnpm">
```bash
pnx skills add yamcodes/arkenv
```
</Tab>

<Tab value="yarn">
```bash
yarn dlx skills add yamcodes/arkenv
```
</Tab>

<Tab value="bun">
```bash
bunx skills add yamcodes/arkenv
```
</Tab>
</Tabs>
```npm
npx skills add yamcodes/arkenv
```

This installs the ArkEnv skill into your project. Once installed, your AI assistant automatically loads it when working with ArkEnv schemas.

Expand Down
35 changes: 14 additions & 21 deletions apps/www/content/docs/arkenv/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ The second argument to `arkenv()` is an optional configuration object.
All options listed below apply to both `arkenv` (ArkType mode) and `arkenv/standard` (Standard Schema mode).
:::

## `env`
## Configuration options

The environment variables to parse. Defaults to `process.env`.
<AutoTypeTable path="../../packages/arkenv/src/create-env.ts" name="ArkEnvConfig" />

## Examples

### Custom env source

You can pass a custom object instead of `process.env`. This is particularly useful in environments like Cloudflare Workers where variables are passed via a context object, or when testing.

```ts twoslash
import arkenv from "arkenv";
Expand All @@ -22,9 +28,9 @@ const env = arkenv(
);
```

## `coerce`
### Disabling coercion

Whether to coerce environment variables to their defined types. Defaults to `true`.
By default, ArkEnv automatically coerces string environment variables to numbers or booleans if the schema requires it. You can disable this behavior:

```ts twoslash
import arkenv from "arkenv";
Expand All @@ -37,20 +43,9 @@ const env = arkenv(

See the [coercion docs](/docs/arkenv/coercion) for more details.

## `onUndeclaredKey`

Control how ArkEnv handles environment variables that are not defined in your schema. Defaults to `"delete"`.
### Custom array format

- `"delete"` β€” Undeclared keys are allowed on input but stripped from the output.
- `"ignore"` β€” Undeclared keys are allowed and preserved in the output.
- `"reject"` β€” Undeclared keys will cause validation to fail.

## `arrayFormat`

The format to use for array parsing when coercion is enabled. Defaults to `"comma"`.

- `"comma"` β€” Strings are split by comma and trimmed.
- `"json"` β€” Strings are parsed as JSON.
When coercion is enabled, you can specify how array strings are parsed.

```ts twoslash
import arkenv from "arkenv";
Expand All @@ -61,11 +56,9 @@ const env = arkenv(
);
```

## `emptyAsUndefined`

Whether to treat empty strings (`""`) as `undefined` before validation. Defaults to `false`.
### Empty strings as undefined

When enabled, an environment variable set to an empty value (e.g., `PORT=` in a `.env` file) will be treated as if it were missing, allowing defaults to apply and preventing validation errors for numeric or boolean types.
When `emptyAsUndefined` is enabled, an environment variable set to an empty value (e.g., `PORT=` in a `.env` file) will be treated as if it were missing. This allows defaults to apply and prevents validation errors for numeric or boolean types.

```ts twoslash
import arkenv from "arkenv";
Expand Down
110 changes: 40 additions & 70 deletions apps/www/content/docs/arkenv/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,93 +11,63 @@ ArkEnv is tested on [**Next.js** **16.x**](https://github.com/yamcodes/arkenv/tr

The easiest way to get started is with the [ArkEnv CLI](/docs/cli). It automatically configures ArkEnv for your project, installs dependencies, and scaffolds your initial schema.

<Tabs items={['npm', 'pnpm', 'yarn', 'bun']}>
<Tab value="npm">
```bash
npx @arkenv/cli@latest init
```
</Tab>

<Tab value="pnpm">
```bash
pnx @arkenv/cli@latest init
```
</Tab>

<Tab value="yarn">
```bash
yarn dlx @arkenv/cli@latest init
```
</Tab>

<Tab value="bun">
```bash
bunx @arkenv/cli@latest init
```
</Tab>
</Tabs>
```npm
npx @arkenv/cli@latest init
```

<Accordions>
<Accordion title="Manual Installation">
<Steps>
<Step>
### Install ArkEnv
### Install ArkEnv [step] [!toc]

<Accordions defaultValue="Install ArkEnv + ArkType (recommended) + Plugins (optional)">
<Accordion title="Install ArkEnv + ArkType (recommended) + Plugins (optional)">
ArkEnv works best when paired with [ArkType](https://arktype.io):
<Accordions defaultValue="Install ArkEnv + ArkType (recommended) + Plugins (optional)">
<Accordion title="Install ArkEnv + ArkType (recommended) + Plugins (optional)">
ArkEnv works best when paired with [ArkType](https://arktype.io):

```package-install
arkenv arktype
```
```package-install
arkenv arktype
```

If you're using Vite, see [ArkEnv for Vite](/docs/vite-plugin).
If you're using Vite, see [ArkEnv for Vite](/docs/vite-plugin).

If you're using Bun, see [ArkEnv for Bun](/docs/bun-plugin).
</Accordion>
If you're using Bun, see [ArkEnv for Bun](/docs/bun-plugin).
</Accordion>

<Accordion title="Install ArkEnv only">
```package-install
arkenv
```
<Accordion title="Install ArkEnv only">
```package-install
arkenv
```

Import from [arkenv/standard](/docs/arkenv/standard) to use ArkEnv without ArkType.
</Accordion>
</Accordions>
</Step>
Import from [arkenv/standard](/docs/arkenv/standard) to use ArkEnv without ArkType.
</Accordion>
</Accordions>

<Step>
### Configure TypeScript (recommended)
### Configure TypeScript (recommended) [step] [!toc]

ArkEnv expects **TypeScript >= 5.1** and `strict` mode in your `tsconfig.json`.
ArkEnv expects **TypeScript >= 5.1** and `strict` mode in your `tsconfig.json`.

You're also expected to use a [modern TypeScript module resolution](https://www.typescriptlang.org/tsconfig/#moduleResolution).
You're also expected to use a [modern TypeScript module resolution](https://www.typescriptlang.org/tsconfig/#moduleResolution).

```json title="tsconfig.json"
// [!code word:config]
{
"compilerOptions": {
"strict": true, // [!code focus]
"moduleResolution": "bundler" // [!code focus] or "node16" / "nodenext"
}
}
```
```json title="tsconfig.json"
// [!code word:config]
{
"compilerOptions": {
"strict": true, // [!code focus]
"moduleResolution": "bundler" // [!code focus] or "node16" / "nodenext"
}
}
```

:::note
While ArkEnv [can](https://github.com/yamcodes/arkenv/tree/main/examples/basic-js) work with plain JavaScript, TypeScript is strongly recommended for the best experience.
:::
</Step>
:::note
While ArkEnv [can](https://github.com/yamcodes/arkenv/tree/main/examples/basic-js) work with plain JavaScript, TypeScript is strongly recommended for the best experience.
:::

<Step>
### Setup ArkType (optional)
### Setup ArkType (optional) [step] [!toc]

While ArkEnv [works with any Standard Schema validator](/docs/arkenv/integrations/standard-schema), we
recommend using ArkType for the ultimate ArkEnv experience.
While ArkEnv [works with any Standard Schema validator](/docs/arkenv/integrations/standard-schema), we
recommend using ArkType for the ultimate ArkEnv experience.

Follow the [ArkType setup](https://arktype.io/docs/intro/setup) to complete your configuration. We
recommend installing the ArkType syntax highlighting extension if your IDE supports it.
</Step>
</Steps>
Follow the [ArkType setup](https://arktype.io/docs/intro/setup) to complete your configuration. We
recommend installing the ArkType syntax highlighting extension if your IDE supports it.
</Accordion>
</Accordions>

Expand Down
Loading
Loading