Sequelize

Sequelize is a JavaScript library that manages most of all the popular databases like PostgreSQL, MySQL, SQLite, and MSSQL. Object Relation Mappers (ORM) are used to convert object-relational syntax to the database schema. Usually, sequelize is used with Node.js. We can call Sequelize an ORM.

Sequelize only supports relational databases. Databases like Mongo DB or other NoSQL databases are not supported. Sequelize supports solid transaction, eager and lazy loading, relations, read replication, and other cool features.

By the end of this tutorial, the reader will adequately understand the following:

  • How to install Sequelize.

  • How to install drivers associated with the different databases.

  • Connecting to the database and testing the connection.

  • How to use Sequelize CLI.

  • Model Querying (Inserting, Updating, Deleting).

  • Associations (One to One, One to Many, Many to Many)

  • Node.js runtime

Prerequisites

Before we continue further, it is recommended to have the following:

  • A basic knowledge of JavaScript.

  • A basic knowledge of Node.js and Express.js.

  • Familiarization with any of these databases i.e MYSQL, POSTGRESQL, MSSQL, SQLite

  • A basic knowledge of Postman, which we will use to test our endpoints.

  • Text Editor - I will be using VS Code.

In this article, we will go through features you will need when using sequelize, and we will be using a project-based approach.

Last updated