npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mongorm/orm

v0.1.7-beta.5

Published

A TypeScript-first MongoDB ORM for applications that want strong types without hiding MongoDB

Readme

Mongorm is a TypeScript-first MongoDB ORM for applications that want strong types and validation without hiding MongoDB behind a large abstraction.

It was created to make the common parts of MongoDB application development consistent: define data once, validate it at the boundary, query it with inferred types, and still keep access to MongoDB when the application needs it.

Features

Typed Schemas

Define the shape of your data once. Mongorm infers the input and output types from the schema and validates writes with Zod-backed fields.

const ROLES = ['admin', 'member'];

const userSchema = orm.schema({
  name: orm.string(),
  email: orm.string().email(),
  role: orm.enum(ROLES),
});

Create, Read, Update, and Delete and Queries

Create records and build readable queries without losing MongoDB filter semantics.

const user = await db.users.create({
  name: 'Ada Lovelace',
  email: '[email protected]',
  role: 'admin',
});

const users = await db.users
  .fields(['name', 'email'])
  .find({ role: 'admin' })
  .sort({ name: 'asc' })
  .limit(20);

Use .first() when a query should return one record or null:

const user = await db.users.find({ email: '[email protected]' }).first();

Relations and Population

Connect related records and load them only when needed.

const user = await db.users
  .find({ email: '[email protected]' })
  .populate([
    {
      ref: 'company',
      fields: ['name', 'address'],
    },
  ])
  .first();

Bulk Operations

Use the same model for individual writes and larger batches.

await db.users.bulk.create([
  { name: 'Grace Hopper', email: '[email protected]', role: 'admin' },
  { name: 'Alan Turing', email: '[email protected]', role: 'member' },
]);

Built-In Application Features

  • Optional timestamps and soft deletes.
  • Hidden fields for sensitive values.
  • Reusable scopes for common read views.
  • Explicit schema indexes with MongoDB options.
  • Cursors, pagination, projections, sorting, and population.
  • Access to the native collection for advanced MongoDB operations.

Getting Started

pnpm add @mongorm/orm
import { createDatabase, orm } from '@mongorm/orm';

const ROLES = ['admin', 'member'];
const userSchema = orm
  .schema({
    email: orm.email(),
    role: orm.enum(ROLES),
    password: orm.string().hidden(),
  })
  .options({
    timestamps: true,
  });

const schema = orm.defineSchemas({
  users: userSchema,
});

const db = createDatabase({
  uri: process.env.MONGODB_URI,
  database: 'app',
  schema,
});

await db.connect();
await db.users.bulk.create([
  { email: '[email protected]', role: 'member', password: 'password' },
  { email: '[email protected]', role: 'admin', password: 'password' },
]);

const user = await db.users
  .find({ email: '[email protected]', role: 'admin' })
  .fields(['$all', '+password'])
  .first();

if (!user) throw new Error('User not found');
console.log(user);

Mongorm keeps the MongoDB driver close at hand, so it simplifies everyday work without limiting access to MongoDB's full feature set.

License

GNU General Public License v3.0