While searching for a good Cassandra ORM for NodeJS, I was a bit frustrated because I couldn't find a good library that would support almost all the Cassandra features. There are some good open source Cassandra ORMs for NodeJS, but they were too basic and didn't support most of the important Cassandra features that distinguished Cassandra from other databases.

Also there are some popular multi-database ORMs like waterline which is part of the sailsjs framework and there is a cassandra adapter for waterline.

But there is something fundamentally wrong about ORMs that tries to support multiple databases. The problem becomes more prevalent, when the same orm does support both SQL and NoSQL dbs. You start to lose the reason for choosing the database of your choice. Because that excellent new feature supported by your db is not supported by your orm. On the other hand, the orm features are too generic that if all your needs are available there, then there was no reason for you to choose any specific database for your app at the first place. Anything would work out well for your app.

So while I chose Cassandra as my database for some specific reasons where Cassandra shines, but could't find many of those "cool" features of Cassandra supported in any of the available Cassandra ORMs for NodeJS. The closest one I could find was Apollo though it looks like it's not actively maintained anymore. Also there are important new features in new Cassandra 3.x that was not supported by any of the available ORM options out there. Hence I decided to write one for me.

How it started

I started based on the Apollo codebase but then largely modified it to suit my needs and eventually wrote my own module express-cassandra. After open sourcing the node module, several other guys joined me on github and contributed to the development of the module. The module now supports most of the Cassandra features including the latest materialized views and aggregate functions.

Current state

Express-Cassandra is a Framework Independent Cassandra ORM for NodeJS. It automatically loads your models and provides you with object oriented mapping to your cassandra tables like a standard ORM.

Since I started writing the Nodejs ORM / ODM for Cassandra, it evolved over time to support more and more cassandra 3.x features and most of the cassandra features became available in the 1.x releases including materialized views, indexed collections, user defined types/functions/aggregates etc. along with some basic support for automatic migrations. I loved to get a lot of valuable feedback in forms of issues and more than 10 contributors from different countries who helped me to enhance and fix things in express-cassandra.

express-cassandra 2 came out with major updates like built in support for Elassandra and JanusGraph, automatic timestamp (createdAt/updatedAt) and document version management, import/export fixtures and some other improvements and fixes documented in the changelog.

Though there are more than 100 functional tests passing now for express-cassandra, but still it only has 73% coverage as of now, which is not very good. I expect the situation will improve in the near future if the acceptance and excitement around this module grows in the open source community.

Benefits

The introduction to these features enables you to use express-cassandra as the nodejs schema manager and object query interface for a distributed data backend with support for cassandra as the database, elasticsearch as the search/analytics service and janusgraph as the graph traversal engine. By storing all the data in cassandra backend, you have now the flexibility of scaling to thousands of nodes with distributed replication of your data and no single point of failure (NOSPOF). On top of this "true" NOSPOF data backend, you can now have the flexibility of search/analytics powered by elasticsearch backed by cassandra (elassandra) and distributed graph traversals with billions of vertices/edges using tinkerpop3 gremlin queries powered by janusgraph with cassandra backend.

What express-cassandra empoweres you to do here is using just a simple JSON schema, you can now manage all of your cassandra tables/views, elasticsearch indexes and graph data from nodejs and provides you with simple query interfaces supporting cassandra object models, elasticsearch queries and gremlin graph traversals. Creating scalable recommendation systems for your nodejs apps should now be simpler than ever. I believe express-cassandra has evolved to become your goto ORM/ODM/OGM for cassandra based data applications written in nodejs/javascript.

Adoption

We at our company started using this module for cassandra based systems and some of the services are running in production already. Early adopters include CodeFoundries URB already using express cassandra for their db persister. Also there seems to be growing interest from promising startups like Healthera, Peerio, Ties Network and PureClarity (evidence taken from forks so far). I hope interests around express-cassandra will grow more and see it make node developers life easier in building scalable applications to handle large and complex data driven systems.

Documentation

https://express-cassandra.readthedocs.io/en/stable/