{"id":37906583,"url":"https://github.com/valtlfelipe/hapi-sequelizejs","last_synced_at":"2026-01-16T17:12:01.562Z","repository":{"id":11417950,"uuid":"69615752","full_name":"valtlfelipe/hapi-sequelizejs","owner":"valtlfelipe","description":"A hapi.js plugin to connect with Sequelize ORM","archived":false,"fork":false,"pushed_at":"2023-02-27T03:10:02.000Z","size":1140,"stargazers_count":62,"open_issues_count":10,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-21T10:18:26.822Z","etag":null,"topics":["hacktoberfest","hapi","hapi-plugin","hapi-sequelizejs","javascript","nodejs","sequelize","sequelize-orm"],"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/valtlfelipe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"valtlfelipe"}},"created_at":"2016-09-29T23:23:10.000Z","updated_at":"2024-03-25T06:26:30.000Z","dependencies_parsed_at":"2024-06-18T20:08:06.054Z","dependency_job_id":null,"html_url":"https://github.com/valtlfelipe/hapi-sequelizejs","commit_stats":{"total_commits":106,"total_committers":12,"mean_commits":8.833333333333334,"dds":0.5660377358490566,"last_synced_commit":"49385b52eb4aa9b775307217dedeb22584831cc3"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/valtlfelipe/hapi-sequelizejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valtlfelipe%2Fhapi-sequelizejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valtlfelipe%2Fhapi-sequelizejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valtlfelipe%2Fhapi-sequelizejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valtlfelipe%2Fhapi-sequelizejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valtlfelipe","download_url":"https://codeload.github.com/valtlfelipe/hapi-sequelizejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valtlfelipe%2Fhapi-sequelizejs/sbom","scorecard":{"id":915495,"data":{"date":"2025-08-11","repo":{"name":"github.com/valtlfelipe/hapi-sequelizejs","commit":"49385b52eb4aa9b775307217dedeb22584831cc3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 1/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/valtlfelipe/hapi-sequelizejs/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/valtlfelipe/hapi-sequelizejs/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/valtlfelipe/hapi-sequelizejs/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/valtlfelipe/hapi-sequelizejs/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/valtlfelipe/hapi-sequelizejs/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/valtlfelipe/hapi-sequelizejs/test.yml/master?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   3 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"32 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-c2jc-4fpr-4vhg","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-4gxf-g5gf-22h4","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mqr2-w7wj-jjgr","Warn: Project is vulnerable to: GHSA-49j4-86m8-q2jw","Warn: Project is vulnerable to: GHSA-fpw7-j2hg-69v5","Warn: Project is vulnerable to: GHSA-4rch-2fh8-94vw","Warn: Project is vulnerable to: GHSA-pmh2-wpjm-fj45","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-8c25-f3mj-v6h8","Warn: Project is vulnerable to: GHSA-vqfx-gj96-3w95","Warn: Project is vulnerable to: GHSA-f598-mfpv-gmfx","Warn: Project is vulnerable to: GHSA-jqv5-7xpx-qj74","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-f9xv-q969-pqx4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T20:49:06.570Z","repository_id":11417950,"created_at":"2025-08-24T20:49:06.571Z","updated_at":"2025-08-24T20:49:06.571Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"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":["hacktoberfest","hapi","hapi-plugin","hapi-sequelizejs","javascript","nodejs","sequelize","sequelize-orm"],"created_at":"2026-01-16T17:12:00.826Z","updated_at":"2026-01-16T17:12:01.555Z","avatar_url":"https://github.com/valtlfelipe.png","language":"JavaScript","readme":"# hapi-sequelizejs\n\n[![npm version](https://img.shields.io/npm/v/hapi-sequelizejs.svg)](https://www.npmjs.com/package/hapi-sequelizejs)\n[![Build Status](https://github.com/valtlfelipe/hapi-sequelizejs/workflows/Test/badge.svg?branch=master)](https://github.com/valtlfelipe/hapi-sequelizejs/actions?query=workflow%3ATest+branch%3Amaster)\n\nA [hapi.js](https://github.com/hapijs/hapi) plugin to connect with [Sequelize ORM](https://github.com/sequelize/sequelize/).\n\n## Support me\n\nIf you like this plugin, please support my work and help maintaining it.\n\n\u003ca href=\"https://www.buymeacoffee.com/valtlfelipe\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" width=\"200\"\u003e\u003c/a\u003e\n\nThanks in advance ❤️\n\n## Compatibility\n\nCompatible with these versions:\n\n-   hapi.js\n    -   `19.x`\n    -   `20.x`\n    -   `21.x`\n-   sequelize\n    -   `5.x`\n    -   `6.x`\n\nCheck the [releases page](https://github.com/valtlfelipe/hapi-sequelizejs/releases) for the changelog.\n\n## Installation\n\n`npm install hapi-sequelizejs`\n\n## Configuration\n\nSimply pass in your sequelize instance and a few basic options and voila. Options accepts a single object\nor an array for multiple dbs.\n\n```javascript\nserver.register([\n    {\n        plugin: require('hapi-sequelizejs'),\n        options: [\n            {\n                name: 'dbname', // identifier\n                models: [__dirname + '/server/models/**/*.js'], // paths/globs to model files\n                ignoredModels: [__dirname + '/server/models/**/*.js'], // OPTIONAL: paths/globs to ignore files\n                sequelize: new Sequelize(config, opts), // sequelize instance\n                sync: true, // sync models - default false\n                forceSync: false, // force sync (drops tables) - default false\n            },\n        ],\n    },\n]);\n```\n\n## Model Definitions\n\nA model should export a function that returns a Sequelize model definition ([http://docs.sequelizejs.com/en/latest/docs/models-definition/](http://docs.sequelizejs.com/en/latest/docs/models-definition/)).\n\n```javascript\nmodule.exports = function (sequelize, DataTypes) {\n    const Category = sequelize.define('Category', {\n        name: DataTypes.STRING,\n        rootCategory: DataTypes.BOOLEAN,\n    });\n\n    return Category;\n};\n```\n\n### Setting Model associations\n\nUsing the sequelize model instance, define a method called `associate`, that is a function, and receives as parameter all models defined.\n\n```javascript\nmodule.exports = function (sequelize, DataTypes) {\n    const Category = sequelize.define('Category', {\n        name: DataTypes.STRING,\n        rootCategory: DataTypes.BOOLEAN,\n    });\n\n    Category.associate = function (models) {\n        models.Category.hasMany(models.Product);\n    };\n\n    return Category;\n};\n```\n\n## Database Instances\n\nEach registration adds a DB instance to the `server.plugins['hapi-sequelizejs']` object with the\nname option as the key.\n\n```javascript\nfunction DB(sequelize, models) {\n    this.sequelize = sequelize;\n    this.models = models;\n}\n\n// something like this\nserver.plugins['hapi-sequelizejs'][opts.name] = new DB(opts.sequelize, models);\n```\n\n## API\n\n### Using `request` object\n\n#### `getDb(name)`\n\nThe request object gets decorated with the method `getDb`. This allows you to easily grab a\nDB instance in a route handler. If you have multiple registrations pass the name of the one\nyou would like returned or else the single or first registration will be returned.\n\n```javascript\nhandler(request, reply) {\n    const db1 = request.getDb('db1');\n    console.log(db1.sequelize);\n    console.log(db1.models);\n}\n```\n\n\u003e If there isn't a db instance for the given name or no registered db instance, an Error is thrown: `hapi-sequelizejs cannot find the ${dbName} database instance`.\n\n##### `db.getModel('User')`\n\nReturns single model that matches the passed argument or null if the model doesn't exist.\n\n##### `db.getModels()`\n\nReturns all models on the db instance\n\n#### `getModels(dbName?)`\n\nReturns all models registered in the given db's name or the models from the first registered db instance if no name is given to the function.\n\n```javascript\nhandler(request, reply) {\n    const models = request.getModels('db1');\n    ...\n}\n```\n\n\u003e If there isn't a db instance for the given name or no registered db instance, an Error is thrown: `hapi-sequelizejs cannot find the ${dbName} database instance`.\n\n#### `getModel(dbName, modelName?)`\n\nReturn the model to the db's name instance. You may give only the model name to the function, if it's the case, it returns the model from the first registered db instance.\n\n```javascript\nhandler(request, reply) {\n    const myModel = request.getModel('db1', 'myModel');\n    ...\n}\n```\n\n\u003e If there isn't a db instance for the given name or no registered db instance, an Error is thrown: `hapi-sequelizejs cannot find the ${dbName} database instance`.\n\u003e If there isn't a model for the given name, an Error is thrown: `hapi-sequelizejs cannot find the ${modelName} model`.\n\n---\n\n### Without `request` object\n\nTo access the dbs intances without using the `request` object you may do this:\n\n```javascript\nconst instances = require('hapi-sequelizejs').instances;\n```\n\n#### `instance.dbs`\n\nReturns an Object with all instances registered.\n\n```javascript\n{\n  [db.name]: db.instance\n}\n```\n\n```javascript\nconst instances = require('hapi-sequelizejs').instances;\nconst dbs = instances.dbs;\n\ndbs.myDb.getModel('User');\n```\n\n#### `getDb(name?)`\n\nReturns the db instance for the given name or the first registered db instance if no name is given to the function.\n\n```javascript\nconst instances = require('hapi-sequelizejs').instances;\n\nconst myDb = instances.getDb('myDb');\n\nconst firstRegisteredDb = instances.getDb();\n```\n\n\u003e If there isn't a db instance for the given name or no registered db instance, an Error is thrown: `hapi-sequelizejs cannot find the ${dbName} database instance`.\n\n#### `getModels(dbName?)`\n\nReturns all models registered in the given db's name or the models from the first registered db instance if no name is given to the function.\n\n```javascript\nconst instances = require('hapi-sequelizejs').instances;\n\nconst myDbModels = instances.getModels('myDb');\n\nconst firstRegisteredDbModels = instances.getModels();\n```\n\n\u003e If there isn't a db instance for the given name or no registered db instance, an Error is thrown: `hapi-sequelizejs cannot find the ${dbName} database instance`.\n\n#### `getModel(dbName, modelName?)`\n\nReturn the model to the db's name instance. You may give only the model name to the function, if it's the case, it returns the model from the first registered db instance.\n\n```javascript\nconst instances = require('hapi-sequelizejs').instances;\n\nconst myDbMyModel = instances.getModel('myDb', 'myModel');\n\nconst firstRegisteredDbMyModel = instances.getModel('myModel');\n```\n\n\u003e If there isn't a db instance for the given name or no registered db instance, an Error is thrown: `hapi-sequelizejs cannot find the ${dbName} database instance`.\n\u003e If there isn't a model for the given name, an Error is thrown: `hapi-sequelizejs cannot find the ${modelName} model`.\n","funding_links":["https://github.com/sponsors/valtlfelipe","https://www.buymeacoffee.com/valtlfelipe"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaltlfelipe%2Fhapi-sequelizejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaltlfelipe%2Fhapi-sequelizejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaltlfelipe%2Fhapi-sequelizejs/lists"}