# papr

> MongoDB TypeScript-aware Models

Latest version **17.1.1** (published 2026-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install papr
pnpm add papr
yarn add papr
bun add papr
```

## Health

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

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 17.1.1 |
| Published | 2026-08-06 |
| First published | 2021-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=22.12.0 |
| Dependencies | 0 |
| Unpacked size | 119 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 500 |
| Author | Plex Inc. |
| Maintainers | marafat, cookandy, marshallasch, slumpy, avaly |
| Keywords | mongodb, database, model, schema, json, json-schema, validation, typescript, types |

## Links

- npm: https://www.npmjs.com/package/papr
- Repository: https://github.com/plexinc/papr
- Homepage: https://plexinc.github.io/papr/
- Issues: https://github.com/plexinc/papr/issues/new
- npm.io page: https://npm.io/package/papr

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 17.1.1 (latest) — 2026-08-06
- 17.1.0 — 2026-05-05
- 17.0.0 — 2026-01-27
- 16.0.0 — 2025-11-21
- 15.2.2 — 2024-05-20
- 15.2.1 — 2024-03-12
- 15.2.0 — 2024-02-07
- 15.1.0 — 2024-01-23
- 15.0.0 — 2023-09-05
- 14.1.0 — 2023-08-21
- 14.0.0 — 2023-07-11
- 13.1.0 — 2023-05-10
- 13.0.0 — 2023-03-24
- 12.0.0 — 2023-03-02
- 12.0.0-0 — 2023-03-01
- … 43 more at https://npm.io/package/papr/versions

## README

# Papr

<div align="center">
	<img alt="Papr" height="125" src="docs/logo.webp" width="98" />
</div>

---

- TypeScript-safe schemas
- JSON Schema MongoDB validation
- :tada: Lightweight library
- :rocket: Blazing fast

---

[![Github Actions](https://github.com/plexinc/papr/actions/workflows/ci.yaml/badge.svg)](https://github.com/plexinc/papr/actions)
[![NPM version](https://img.shields.io/npm/v/papr.svg?style=flat)](https://www.npmjs.com/package/papr)
[![Install size](https://packagephobia.now.sh/badge?p=papr)](https://packagephobia.now.sh/result?p=papr)

`papr` is a lightweight library built around the MongoDB NodeJS driver, written in TypeScript.

`papr` uses MongoDB's [JSON Schema validation](https://docs.mongodb.com/manual/core/schema-validation/#json-schema) feature to enable validation of document writes at runtime (requires MongoDB 3.6+).

`papr` has a familiar API - if you have used the raw `mongodb` methods to query and change documents before, then you already know how to use `papr`.

## Sample code

<!-- prettier-ignore -->
```ts
import Papr, { schema, types } from 'papr';

const papr = new Papr();

const User = papr.model('users', schema({
  age: types.number(),
  firstName: types.string({ required: true }),
  lastName: types.string({ required: true }),
}));

const johnWick = await User.find({ firstName: 'John', lastName: 'Wick' });
```

## Documentation

Read the documentation at: [plexinc.github.io/papr](https://plexinc.github.io/papr/)

## Contributing

Please read the [contributing](CONTRIBUTING.md) guidelines.

Before contributing, please read the [Code of conduct](CODE_OF_CONDUCT.md).

## License

MIT

## Inspiration

- [Mongoose](https://mongoosejs.com/)
- [ts-mongoose](https://github.com/lstkz/ts-mongoose)

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