plexinc/papr

README

Papr


Papr

TypeScript-safe schemas
JSON Schema MongoDB validation
🎉* Lightweight library
🚀* Blazing fast

Github Actions

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

papr uses MongoDB's JSON Schema validation 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


  1. ``` ts
  2. import Papr, { schema, types } from 'papr';

  3. const papr = new Papr();

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

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

Documentation


Read the documentation at: plexinc.github.io/papr

Contributing


This repository is following the Conventional Commits standard.

License


MIT

Inspiration


Mongoose
ts-mongoose