npm node Build Status Coverage Status npm

Consider using Massive's successor, monstrous, especially for new development! monstrous applies the same concepts in a fluent query-builder format emphasizing composability and statement reuse, but the API surface is completely different and there is no easy upgrade path. Massive has been stable and very passively developed for years so not much is changing immediately.

I'll continue to help land community contributions for the near but unspecific future; if you've contributed code, reports, or helped others with/posted about using Massive and are interested in maintainership, raise an issue or contact me!

Massive is a data mapper for Node.js that goes all in on PostgreSQL and embraces the power and flexibility of SQL and the relational model. With minimal abstractions for the interfaces and tools you already use, its goal is to do just enough to make working with your data and your database as easy and intuitive as possible, then get out of your way.

Massive is not an object-relational mapper (ORM)! It doesn't use models, it doesn't track state, and it doesn't box you into working and thinking in terms of individual entities, barely scratching the surface of what PostgreSQL can do. Instead, Massive analyzes and builds an API for the data model expressed in your database's tables, views, and functions, simplifying routine SQL generation without hiding SQL itself so your applications can use Postgres to the fullest possible extent.

Here are some of the highlights:

  • Dynamic query generation: Simple criteria objects represent a wide array of comparison operations and even predicates delving into JSON fields. Outside the WHERE clause, Massive can generate everything from complex sorting with order to true upserts with onConflict.
  • Join what you need, when you need it: Call join() on any table or view to bring the programmatic flexibility of Massive's API and SQL statement generation to multiple relations at once.
  • Document storage: PostgreSQL's JSONB data type makes blending relational and document techniques practical. Massive makes it easy: create document tables at runtime, pass objects in, get objects out, with metadata managed for you every step of the way.
  • Transactions: db.withTransaction() executes a callback with full Massive API support in a transaction scope, automatically rolling changes back if an exception occurs.
  • Low overhead: An API built from your schema means direct access to your tables, views, and functions; raw SQL ad hoc or managed in a central scripts directory; super-simple bulk operations; and no model classes to maintain!
  • Postgres everything: Many, if not most, relational data access tools are designed for compatibility across multiple relational database management systems. Massive is not. By committing to a single RDBMS, Massive gains support for array fields and operations, regular expression matching, foreign tables, materialized views, and more features found in PostgreSQL but not its competition.

Install

npm install massive --save

For next steps after that, see Get Started.

Contributing

Visit the project page to report issues or check out the code!

Licensing

Massive is released under the BSD 3-Clause license. You may use it free of charge, including in commercial software products you release under your own warranty. You may not hold the project or its contributors liable for any reason or claim its contributors endorse whatever you're doing with it. If you redistribute Massive you must include the copyright and license. This is automatic assuming you're using a package manager like npm or yarn.

MassiveJS.org content is covered by the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 (CC BY-NC-SA 4.0) license. You may copy and modify it to your heart's content, but if you want to share or distribute your modifications you can't make money off it, and your derivative work must be released under the same terms.