Introduction

What is Waterline

Summary

Waterline is an adapter-based ORM for Node.js, designed to connect to various datastores using the Adapter pattern.

While it can be used independently in Node.js projects, it’s the first-party ORM built into the Sails framework, offering seamless integration. Waterline’s datastore-agnostic design allows developers to work with multiple databases simultaneously by simply installing the relevant adapters via NPM.

For example, one table can use Postgres while another uses MySQL, all accessed through a unified query interface. This makes it similar to popular ORMs like Active Record and Mongoose but with unique features tailored for full-stack Node.js applications.

Waterline simplifies database interactions, whether relational, document-based, or key-value stores like Redis, providing a single, consistent API.

Transcript

Okay, we now have visited what an ORM is. So I believe we have a good starting point or a refresher on what an ORM is if you already know what that is. So we're going to look at what is Waterline because that's what this course is about.

Waterline is an adapter-based ORM for Node.js. So what that means is that Waterline follows the Adapter pattern in order to connect to different datastores or databases.

And you could use Waterline standalone in a Node.js project, not necessarily a Sails app. But if you are using Sails, Waterline is the first-party ORM in Sails. So it comes built into Sails, and it's been integrated with the Sails framework pretty well. So you could just use it, plug and play. All right.

So I really like Waterline because of the ease of use it brings. And because it's datastore agnostic, following a particular adapter-based pattern. So that means if you want to use Waterline with any database or datastore, all you have to do is go through NPM, look for the official adapter, which they are for most of the most popular databases and datastores.

Then you just install that adapter, you give it to Waterline, and immediately Waterline knows how to get and store data onto that datastore, which is incredible. So with Waterline, you can have more than one datastore in a project, which is why I like it. So you could say this table should use a Postgres database.

While that table should use, okay, MySQL or an MS SQL database, and you will not need to worry about the interface because the old access to those databases, even though they are very diverse and different, is unified with the Waterline query language. So it's pretty good, and it just makes working with databases and datastores in a full-stack or a backend application a breeze.

So it follows the pattern of a very popular ORM like Active Record and Mongoose. So it borrows from these ORMs to make something much more unique and very easy to use when you're building a full-stack Node.js application. So that's what Waterline is, an adapter-based ORM for Node.js. You could use it in a separate Node.js application, which is not Sails, but if you're using Sails, you already have Waterline configured for you. So you just have to use it and enjoy the flexibility in accessing and storing data without regard to the database or datastore, whether it's a relational database or it's a document or a key-value store like Redis.

Waterline doesn't care; it just gives you a single API, and you can just access them.

Full Course

$
34.99

USD

plus local taxes
Buy Now