Sequelize

Sequelize

sequelize.org

2

About this website

Sequelize is a modern TypeScript and Node.js object-relational mapper supporting Oracle, PostgreSQL, MySQL, MariaDB, SQLite, Microsoft SQL Server, and IBM DB2. Originally created by Sascha Depold in 2011, the project has grown into one of the most widely used Node.js ORMs with over 29,000 GitHub stars and extensive production deployment at organizations including Walmart Labs and Uphold, which has relied on Sequelize for over 7 years while scaling to 12 million users. Sequelize maps database tables to JavaScript model classes using a declarative definition syntax, where each model specifies field names, data types, validation rules, and default values. The ORM automatically generates SQL for CRUD operations, joins, aggregations, and complex WHERE clauses, with both promise-based and async/await APIs. Association types include belongsTo, hasOne, hasMany, and belongsToMany, with automatic generation of mixin methods like getWishes, createWish, and removeWish on associated model instances. Eager loading is supported through the include option with nested association chains, while lazy loading triggers queries only when association properties are accessed. Sequelize provides read replication with automatic round-robin distribution of SELECT queries across multiple read replicas and writes directed to the primary server. The paranoid mode implements soft deletion by setting a deletedAt timestamp instead of executing DELETE statements, allowing soft-deleted records to be filtered from queries while remaining recoverable. Transaction support covers unmanaged, managed, and savepoint-based transactions with serializable isolation levels. Additional features include lifecycle hooks for beforeCreate, afterUpdate, and beforeDestroy events, database schema migrations via the CLI, scope definitions for reusable query filters, virtual fields, and raw SQL fallbacks for queries that exceed the query builder's capabilities.

Tags & Categories

Statistics

2
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!