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

masquerade-orm

v0.8.1

Published

Lightweight ORM compatible with SQLite and Postgresql in Node.js

Readme

MasqueradeORM is a lightweight ORM for Node.js that works seamlessly with both TypeScript and JavaScript.

Its goal is to hide SQL complexity while letting you work naturally in JS/TS syntax. Instead of forcing you into ORM-specific models, metadata systems, or decorators, MasqueradeORM lets you use your own classes directly, exactly as you normally would.

MasqueradeORM improves readability, maintainability, and workflow simplicity through a unified coding approach and extremely minimal setup. No ORM offers a simpler start. There’s no need to manage heavy configuration layers, maintain secondary schema systems, or even plan your database structure separately. Your schema and tables are generated automatically from a single source of truth: Your class definitions.

MasqueradeORM currently supports the following SQL clients:

  • SQLite
  • Postgresql

Installation

npm install masquerade-orm

Features

  • Effortless setup - no ORM-specific structures; just use your classes.
  • Zero schema planning - tables and schema are generated automatically.
  • Powerful IntelliSense - confidently build complex queries with real-time IDE feedback when something’s wrong.
  • Minimal memory usage - one class instance per database row, minimizing memory usage and avoiding duplicates through smart state management.
  • Optimized querying - fewer queries through intelligent transaction grouping without sacrificing data integrity.
  • Relational WHERE clauses - easily write conditions that compare two columns within the same table or columns across different tables.
  • Write complex WHERE conditions using a template-literal helper - enabling expressive comparisons like >=, LIKE, object-property access, and even array element matching, all without cluttering your query code.
  • SQL injection protection - all queries are parameterized.
  • Lightweight - minimal dependencies.
  • Strong typing even in JavaScript - powered by JSDoc, no compile step required.
  • Reduced data transfer size - improves performance in client-server setups (not applicable for embedded databases like SQLite).
  • Abstract and non-abstract inheritance - enables the use of abstract classes, even in JavaScript.
  • Combines the convenience of embedded SQLite with the strict typing of RDBMS
  • Eager and lazy relations
  • Unidirectional, bidirectional, and self-referenced relations

Example Code Implementation

Creating an ORM-Compatible Class

import { Entity } from 'masquerade'

type UserSettings = {
    theme: 'light' | 'dark' | 'system'
    twoStepVerification: boolean
    locale: 'en' | 'es' | 'fr' | 'de'
}

export class User extends Entity {
    username: string
    email: string
    password: string
    createdAt: Date = new Date()
    friendList: User[] = []
    settings: UserSettings & object = {
        locale: "en",
        theme: "system",
        twoStepVerification: false
    }

    constructor(username: string, email: string, password: string) {
        super()
        this.username = username
        this.email = email
        this.password = password
    }
}

Basic Find Example

// finds any User instance with email === lookupEmail
async function findUserByEmail(lookupEmail: string): Promise<User | undefined> {
    const resultArray = await User.find({
        where: { email: lookupEmail }
    })
    // the static 'find' method above is inherited from 'Entity'

    return resultArray[0]
}

Saving Instances

// Creating a new table row in the User table
const newUser = new User('JohnDoe57', '[email protected]', 'passwordHash')
// newUser will be saved to the database automatically, no explicit save call is required.

// Finding a user by email
const user = await findUserByEmail('[email protected]') // user's friendList is a promise
console.log(user.username === 'JohnDoe57') // true

Mutating Data

All mutations are persisted implicitly and automatically, meaning that simply changing a value is enough for it to be reflected in the database.

Mutating non-Relational Properties

user.settings.theme = 'dark' 

Mutating Relational Properties

// lazy-load friendList
await user.friendList 
// add a new relation
user.friendList.push(new User('JaneDoe33', '[email protected]', 'passwordHash2')) 
// remove a relation
user.friendList.pop() 

Further Reading