Around 8 months ago, I decided to create something that has never been done before: an ORM. But not just any ORM, an ORM that requires only plain classes: no decorators, no schema.prisma files, no repositories, no entity managers.
MasqueradeORM only requires the classes to extend Entity, a class that the ORM provides. The ORM infers the database schema from your property types (TS or JSDoc), creates tables/columns automatically, and gives you a single instance per row via a process-wide identity map (WeakRefs + FinalizationRegistry for deduplication and low memory usage).
class User extends Entity {
name!: string
email!: string
posts!: Post[] // relation
}
const res = await User.find({ id: 1 })
const user = res[0]
user.name = "New Name"
user.posts.push(new Post({ title: "Hello" }))
await someAsyncThing() // changes flush here (implicit)
Key features:
- Memory efficient - one instance per database row (no duplication in relation graphs), WeakRefs prevent leaks
Just write classes - no decorators, no schema files, no repositories, no entity managers.
- Expressive queries - declarative criteria-based querying with object filters for simple cases, plus embedded sql templates and scoped builder functions for deep relational / complex logic.
- Relations - eager/lazy loading, bidirectional relations, set new relations without loading, or even add a relation in X-to-many relations without loading the relation.
- Auto schema - creates tables/columns from classes, detects unused columns/tables/junctions, manual cleanup when safe
Databases - SQLite + PostgreSQL (MySQL on the board)
It's pre-1.0 / experimental: missing explicit transactions, schema evolution is manual (unused columns and tables stay until you drop them using a built-in helper class), no built-in caching yet.
Built for prototypes, personal apps, tools, anyone who hates ORM boilerplate, or those who enjoy experimenting. The identity map and plain-class approach are the parts I'm most proud of.
Would love honest feedback: Are the docs clear? Does the memory efficiency hold up in real graphs? What breaks for you? Missing features? Too magical? Too risky?
Thanks for looking!
(Repo has docs, getting-started guides for TS/JS, and more examples.)
masqueradeorm•2h ago
Around 8 months ago, I decided to create something that has never been done before: an ORM. But not just any ORM, an ORM that requires only plain classes: no decorators, no schema.prisma files, no repositories, no entity managers.
MasqueradeORM only requires the classes to extend Entity, a class that the ORM provides. The ORM infers the database schema from your property types (TS or JSDoc), creates tables/columns automatically, and gives you a single instance per row via a process-wide identity map (WeakRefs + FinalizationRegistry for deduplication and low memory usage).
Repo: https://github.com/MasqueradeORM/MasqueradeORM
NPM: npm i masquerade-orm (v0.9.2)
Example:
Key features:- Memory efficient - one instance per database row (no duplication in relation graphs), WeakRefs prevent leaks Just write classes - no decorators, no schema files, no repositories, no entity managers.
- Expressive queries - declarative criteria-based querying with object filters for simple cases, plus embedded sql templates and scoped builder functions for deep relational / complex logic.
- Relations - eager/lazy loading, bidirectional relations, set new relations without loading, or even add a relation in X-to-many relations without loading the relation.
- Auto schema - creates tables/columns from classes, detects unused columns/tables/junctions, manual cleanup when safe Databases - SQLite + PostgreSQL (MySQL on the board)
It's pre-1.0 / experimental: missing explicit transactions, schema evolution is manual (unused columns and tables stay until you drop them using a built-in helper class), no built-in caching yet. Built for prototypes, personal apps, tools, anyone who hates ORM boilerplate, or those who enjoy experimenting. The identity map and plain-class approach are the parts I'm most proud of. Would love honest feedback: Are the docs clear? Does the memory efficiency hold up in real graphs? What breaks for you? Missing features? Too magical? Too risky? Thanks for looking! (Repo has docs, getting-started guides for TS/JS, and more examples.)