{"id":14969233,"url":"https://github.com/easterneas/fastify-sequelize","last_synced_at":"2026-01-24T14:45:27.694Z","repository":{"id":57110421,"uuid":"420443030","full_name":"easterneas/fastify-sequelize","owner":"easterneas","description":"A plugin for Fastify to integrate Sequelize into your project. Supports Sequelize 6 and can play along nicely with `sequelize-cli`.","archived":false,"fork":false,"pushed_at":"2021-10-24T15:01:28.000Z","size":288,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-04T15:46:55.322Z","etag":null,"topics":["fastify","fastify-plugins","nodejs","sequelize","sequelize-cli"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/easterneas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-23T15:00:09.000Z","updated_at":"2024-05-10T09:17:04.000Z","dependencies_parsed_at":"2022-08-20T21:50:34.784Z","dependency_job_id":null,"html_url":"https://github.com/easterneas/fastify-sequelize","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/easterneas/fastify-sequelize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easterneas%2Ffastify-sequelize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easterneas%2Ffastify-sequelize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easterneas%2Ffastify-sequelize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easterneas%2Ffastify-sequelize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/easterneas","download_url":"https://codeload.github.com/easterneas/fastify-sequelize/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easterneas%2Ffastify-sequelize/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28730187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastify","fastify-plugins","nodejs","sequelize","sequelize-cli"],"created_at":"2024-09-24T13:41:24.496Z","updated_at":"2026-01-24T14:45:27.679Z","avatar_url":"https://github.com/easterneas.png","language":"JavaScript","readme":"# fastify-sequelize\n\nThis is a plugin for Fastify to integrate Sequelize deeply into your project.\nSupports Sequelize up to version 6 and can play along nicely with `sequelize-cli`.\n\n`fastify-sequelize` mostly 'borrows' the mechanics of `sequelize-cli`'s `index.js`\nmodel file. By doing so, it will be imported immediately, making generated\nSequelize models ready to use.\n\n## Why the fuss?\n\nI think integrating directly into `fastify` instance is better (and cleaner, in\nmy opinion). And by doing so, handling routes will eliminate the need to\nimport `models` directory manually to each route handlers (or controllers).\n\n## Installation\n\n1. Install via:\n   - NPM: `npm i @easterneas/fastify-sequelize`, or\n   - Yarn: `yarn add @easterneas/fastify-sequelize`\n2. Register this plugin:\n   ```js\n     fastify.register(require('@easterneas/fastify-sequelize'), options)\n   ```\n   where `options` contains your Sequelize configuration.\n3. There is no step 3, by now you can use it through `this.models` (or\n   `fastify.models`) already!\n\n### Example\n\nIt's pretty easy to integrate the already-installed Sequelize to your Fastify project.\nLet me show you how.\n\nI will assume that your Sequelize configuration file is in a default location,\ncreated through `sequelize-cli` package.\n#### If you have Fastify project made with `fastify-cli`\n\n```js\nconst fp = require('fastify-plugin')\nconst config = require('../config/config.json')\n\nmodule.exports = fp(async function (fastify, opts) {\n  fastify.register(require('@easterneas/fastify-sequelize', config))\n})\n```\n\n#### If you create your Fastify project manually\n\n```js\n// app.js\n\nconst fastify = require('fastify')\nconst config = require('./config/config.json')\n\nconst app = fastify()\n\nfastify\n// ...\n.register(require('@easterneas/fastify-sequelize'), config)\n// ...\n// .listen( ... )\n```\n\n## Usage\n\nAfter installation, you can just use `this.models` when you handle through routes.\n\nBy default, `sequelize` and `Sequelize` are included, and it will search through\ndefault `models` in your project's root directory.\n\nIf there is one, it will start importing and parsing Sequelize models, either\nit's generated manually, or by using `sequelize-cli` package. Neat!\n\n## Issues\n\nIf there are bugs appeared when using this plugin, feel free to create\n[a new issue](https://github.com/easterneas/fastify-sequelize/issues).\nBut remember to always add logs and the version of the plugin before posting\nissues here, and thank you for letting me know about the issues!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasterneas%2Ffastify-sequelize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasterneas%2Ffastify-sequelize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasterneas%2Ffastify-sequelize/lists"}