# Packages

> Every package ArkType publishes, its entrypoints, and what to import from each.

To define and validate Types, install `arktype`. It has zero runtime dependencies and exposes its regex parser, schema layer, and utilities under subpaths (`arktype/regex`, `arktype/schema`, `arktype/util`). Each package publishes under exactly one name, the one listed here; `@ark/type`, `@ark/regex`, `@ark/schema`, `@ark/util`, `@ark/json-schema` and the `@arktype/*` names are [no longer published](https://arktype.io/docs/upgrading#package-names).

| Package | Install it to | Docs |
| - | - | - |
| `arktype` | define Types and validate data | [Setup](https://arktype.io/docs/intro/setup) |
| `@ark/aot` | construct your Types when you build | [Precompile](https://arktype.io/docs/precompile) |
| `arkregex` | write regular expressions with inferred types | [ArkRegex](https://arktype.io/docs/regex) |
| `@ark/attest` | assert types and benchmark them in your tests | [Attest](https://arktype.io/docs/attest) |
| `@ark/fast-check` | generate test data from a Type with fast-check | [fast-check](https://arktype.io/docs/fast-check) |
| `@ark/fs` | nothing: it's the filesystem layer `@ark/attest` uses | |

Editor integrations for VS Code (and its forks), JetBrains IDEs, Zed, Neovim and Helix, plus "ArkThemes" for VS Code, are on the [Editor](https://arktype.io/docs/editor) page.

## arktype

| Entrypoint | Import it for |
| - | - |
| `arktype` | everything you use day to day (below) |
| `arktype/codecs` | `codec`, and the `.encode` every Type has once it's imported ([Codecs](https://arktype.io/docs/codecs)) |
| `arktype/errors` | installs `errors: "first"` and `"none"` ([errors](https://arktype.io/docs/configuration#errors)) |
| `arktype/mutatesInput` | installs `mutatesInput: true` and `"always"` ([mutatesInput](https://arktype.io/docs/configuration#mutatesinput)) |
| `arktype/regex` | `regex` and the `Regex` type ([ArkRegex](https://arktype.io/docs/regex)) |
| `arktype/schema` | schema nodes, `rootSchema`, `schemaScope` and `ArkErrors` internals ([Internals](https://arktype.io/docs/internals), not semver-stable) |
| `arktype/util` | shared utilities used by ArkType (not semver-stable) |
| `arktype/runtime` | what [precompiled](https://arktype.io/docs/precompile) validators run on. A build resolves `arktype` to it; you don't import it yourself |
| `arktype/config` | `configure`, before anything else from `arktype` is imported |
| `arktype/locales/en`, `arktype/locales/de` | the `en` and `de` [locales](https://arktype.io/docs/i18n) |
| `arktype/i18n` | helpers that [a locale](https://arktype.io/docs/i18n) uses: `listPattern`, `isolate`, `labelOf`, `groupByPath`, `printedActualOf`, `describeCause`, `describeMissing`, `writeKeywordExpected` |
| `arktype/internal`, `arktype/internal/*.ts` | every module's exports, for tools built on ArkType. Not semver-stable. |

These entrypoints are `arktype`'s whole public surface. Any other subpath it exports, like `arktype/schema/internal`, `arktype/schema/issueFeatures` or `arktype/schema/runtime/*`, is not semver-stable.

`arktype` is ES2022 that calls only ES2020 built-ins, so it runs wherever both are supported. CI tests it on the two latest Node LTS lines and Node's current release, Deno, Bun, Chrome and Firefox, and on the TypeScript versions [Setup](https://arktype.io/docs/intro/setup#configure-typescript) lists.

`arktype` exports:

- `type`, `scope`, `match`, `generic`, `declare`, `define` and `fn` to define Types, and `keywords` and `ark`, the keywords as a module and as a scope.
- `fromJsonSchema`, which reads a JSON Schema or a Standard JSON Schema, like a Zod schema, into a Type ([From JSON Schema](https://arktype.io/docs/json-schema/from-json-schema)).
- `regex`, the same function `arkregex` exports.
- `Type`, `Module` and `Generic` to check a value with `instanceof`, and `Hkt` to write a [higher-kinded generic](https://arktype.io/docs/generics#hkt).
- `ArkErrors`, `TraversalError`, `ParseError` and `ToJsonSchemaError`, the [errors](https://arktype.io/docs/errors) ArkType returns and throws, `ArkError`, the type of one issue, and `Traversal`, the type of the `ctx` a [narrow or morph](https://arktype.io/docs/traversal-api) receives.
- `byPath`, `flatByPath`, `flatMessagesByPath`, `byAncestorPath`, `firstIssue`, `lineOf` and `messageIn`, which [read an `ArkErrors` or `ArkError`](https://arktype.io/docs/errors#arkerrors).
- `annotatingFallback`, a [JSON Schema fallback](https://arktype.io/docs/json-schema/to-json-schema#annotatingfallback), and `inferred`, the symbol key a Type's inferred type is declared under.
- types such as `Out`, `Brand`, `Json`, `JsonSchema`, `ArkErrorCode`, `Locale`, `Scope`, `BaseType` and `inferDefinition`/`validateDefinition` for [wrapping `type`](https://arktype.io/docs/generics#external).

`arktype` exports `configure` too, but importing it from there loads all of `arktype` first. Configure in a file of its own, and import that file before anything else:

```ts
import { configure } from "arktype/config"

configure({ onUndeclaredKey: "delete" })
```

```ts
import "./config.ts"
import { type } from "arktype"
```

`arktype` also installs an `ark` CLI (`init`, `migrate`, `skill`, and `check`, `emit` and `declare` via `@ark/aot`). Outside a project with `arktype` installed, invoke it as `npx arktype` rather than `npx ark` (`ark` on npm is an unrelated package).

## Other packages

- **`@ark/aot`** has an entrypoint for each way to run it: `@ark/aot/unplugin` (`precompile.vite()`, `.rollup()`, `.webpack()` and the other bundlers), `@ark/aot/node` (`register()`), `@ark/aot/bun` (`precompile()`), `@ark/aot/turbopack` (a loader, `withPrecompile()` for `next.config` and `@ark/aot/turbopack/runtime` for its alias) and `@ark/aot/eslint` (`configs.recommended`). Its CLI commands run through `ark` (`ark check`, `ark emit`, `ark declare`, or `npx arktype check`/`emit`/`declare`), and `@ark/aot` itself exports `Precompiler`, whose `analyze()` the CLI and ESLint rule run. It needs Node 22.12 or later, and `typescript` 5.5 to 6 (or TypeScript 7.1+ via `tsgo` or `tsrs`) for declarations. See [Setup](https://arktype.io/docs/precompile/setup).
- **`arkregex`** exports `regex`, which is also exported from `arktype`, and the `Regex` type.
- **`@ark/attest`** exports `attest`, `bench`, `setup` and `teardown`, and installs an `attest` CLI. Install it as a dev dependency.
- **`@ark/fast-check`** exports `arkToArbitrary`. It needs `fast-check` 3 or 4 installed beside it.

`@ark/fast-check` and `@ark/attest` each peer on an exact version of `arktype`, and `@ark/aot` precompiles with the `arktype` it imports. Install the versions released alongside your `arktype` so your project doesn't load two copies of it.

`arkregex` also has an `./internal` entrypoint like `arktype`'s, and every package above has `./internal/*.ts` deep imports. None of them are semver-stable.
