# @atproto/lexicon

> atproto Lexicon schema language library

Latest version **0.7.14** (published 2026-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @atproto/lexicon
pnpm add @atproto/lexicon
yarn add @atproto/lexicon
bun add @atproto/lexicon
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.7.14 |
| Published | 2026-09-11 |
| First published | 2022-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=22 |
| Dependencies | 4 |
| Unpacked size | 655.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 9624 |
| Maintainers | dholms, pfrazee, devinivy, estrattonbailey, matthieu-bluesky |
| Keywords | atproto, lexicon |

## Links

- npm: https://www.npmjs.com/package/@atproto/lexicon
- Repository: https://github.com/bluesky-social/atproto
- Homepage: https://atproto.com
- npm.io page: https://npm.io/package/@atproto/lexicon

## Dependencies (4)

- [zod](https://npm.io/package/zod.md) ^3.23.8
- [multiformats](https://npm.io/package/multiformats.md) ^13.0.0
- [@atproto/syntax](https://npm.io/package/@atproto/syntax.md) ^0.7.6
- [@atproto/common-web](https://npm.io/package/@atproto/common-web.md) ^0.5.12

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads
- [@react-md/material-icons](https://npm.io/package/@react-md/material-icons.md) — 1.6K weekly downloads

## Recent versions

- 0.7.14 (latest) — 2026-09-11
- 0.0.0-spaces-alpha-20260915164701 (alpha) — 2026-09-15
- 0.7.0-next.0 (next) — 2026-05-18
- 0.4.1-rc.0 (rc) — 2024-07-30
- 0.0.3 (beta) — 2023-01-03
- 0.0.0-spaces-alpha-20260913191958 — 2026-09-13
- 0.0.0-spaces-alpha-20260910230440 — 2026-09-10
- 0.0.0-spaces-alpha-20260910223605 — 2026-09-10
- 0.0.0-spaces-alpha-20260910222405 — 2026-09-10
- 0.7.12 — 2026-08-26
- 0.0.0-spaces-alpha-20260818163953 — 2026-08-18
- 0.0.0-spaces-alpha-20260818023850 — 2026-08-18
- 0.0.0-spaces-alpha-20260818021221 — 2026-08-18
- 0.7.11 — 2026-08-06
- 0.7.10 — 2026-08-03
- … 45 more at https://npm.io/package/@atproto/lexicon/versions

## README

# @atproto/lexicon: schema validation library

TypeScript implementation of the Lexicon data and API schema description language, which is part of [atproto](https://atproto.com).

[![NPM](https://img.shields.io/npm/v/@atproto/lexicon)](https://www.npmjs.com/package/@atproto/lexicon)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

## Usage

```typescript
import { Lexicons } from '@atproto/lexicon'

// create your lexicons collection
const lex = new Lexicons()

// add lexicon documents
lex.add({
  lex: 1,
  id: 'com.example.post',
  defs: {
    // ...
  }
})

// validate
lex.assertValidRecord('com.example.record', {$type: 'com.example.record', ...})
lex.assertValidXrpcParams('com.example.query', {...})
lex.assertValidXrpcInput('com.example.procedure', {...})
lex.assertValidXrpcOutput('com.example.query', {...})
```

## License

This project is dual-licensed under MIT and Apache 2.0 terms:

- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)

Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.

---
_Source: https://npm.io/package/@atproto/lexicon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
