Home - nodify/nodify-persist GitHub Wiki

Easily persist node.js objects with MySQL, SQLite or Mongo.

Intro

Nodify-persist adds an easy(ish) to use persistence tier to your node.js applications. It provides a regular interface between your application and common database drivers. Application developers use a simple JSON object to describe the schema of a database table or collection; nodify-persist reads this description and creates a data access object to create, read, update and delete records in the collection.

Nodify-persist is not an object-relational mapping package. It does not build a SQL table or Mongo collection from your object definitions. You still have to define the structure of tables or collections. But it does handle the mundane tasks of creating tables, building accessors and managing the connection to the database.

Though you still need to have knowledge of the underlying database technology, it does move database specific features into a declarative JSON initialization object. Application developers provide SQL or Mongo-specific setup data during initialization, but during steady state usage, a implementation-independent API is used to access data from the persistence tier.

Also, nodify-persist binds records in a table (or collection) to a prototype object so database reads return objects with behavior, not blank maps of field-names to data.

Please note that nodify-persist trades expressiblity for convenience. In reducing the complexity of dealing directly with the database, there are some complex database schemas which cannot be effectively modeled with this package. However, we have noted it effectively models the vast majority of database tables we have wanted to use. If you are building a simple or moderately complex web application, nodify-persist is probably still a net win. In short, if you're not using a complex database schema, you won't miss what you aren't using.

Where to go from here

If you want to see a simple example, click over to the Simple Example page.

For a list of examples, see the Examples page.

We also have a Developers' Guide which describes features seen in the examples.

For information on installing nodify-persist, check out the Installing Nodify-Persist page.