Sequelize Complete Guide
Sequelize is a mature, promise-based Object-Relational Mapper for Node.js that works across PostgreSQL, MySQL, MariaDB, SQLite, and SQL Server. It maps JavaScript model classes directly onto relational tables, generating the SQL for you while adding built-in validation, lifecycle hooks, and a declarative way to describe associations between tables. This doc walks through the 8 things a backend engineer actually needs to know to use Sequelize well in production β in the order you'll naturally run into them β with a diagram, a "where to use it" guide, and concrete implementation steps for every single one.
Use the sidebar to jump straight to any topic β each one opens its own page with a full explanation, a diagram of how it fits together with the concepts around it, and the concrete steps (with real code) to actually use it. If you're starting from zero, work through the topics top to bottom: nothing past model definitions makes much sense without a working connection and at least one model in place.
Everything you write is a JS model; Sequelize translates it into the correct dialect's SQL and runs it against the actual database. Everything in the row below is what keeps that translation safe and predictable β schema changes go through migrations, relationships through associations, data integrity through validations and hooks, and multi-step writes through transactions.
All 8 topics in this guide
Summary & Patterns
Once the individual topics make sense on their own, these references tie them together: the order to learn them in, and the one diagram every Sequelize user eventually needs β how the three association types actually differ.
Recommended Learning Order
hasOne / hasMany / belongsToMany at a glance
hasOne adds a foreign key that points at a single related row; hasMany is the same foreign key, just on the "many" side; belongsToMany needs a real intermediate table (PostTag) holding a foreign key to each side, since neither Post nor Tag can hold a column referencing multiple rows on the other side.
Official Documentation Reference URLs
Every topic covered in this guide, with a direct link to its official Sequelize v6 docs.