{"id":13941474,"url":"https://github.com/aichholzer/modellr","last_synced_at":"2026-02-17T08:36:11.354Z","repository":{"id":26662453,"uuid":"108800383","full_name":"aichholzer/modellr","owner":"aichholzer","description":"Database connection manager for Sequelize.","archived":false,"fork":false,"pushed_at":"2022-07-25T01:00:18.000Z","size":200,"stargazers_count":2,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T10:11:43.318Z","etag":null,"topics":["database-connection","database-management","database-schemas","manager","models","sequelize"],"latest_commit_sha":null,"homepage":null,"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/aichholzer.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":"2017-10-30T04:06:28.000Z","updated_at":"2022-03-01T16:53:14.000Z","dependencies_parsed_at":"2022-08-29T16:11:58.675Z","dependency_job_id":null,"html_url":"https://github.com/aichholzer/modellr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichholzer%2Fmodellr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichholzer%2Fmodellr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichholzer%2Fmodellr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichholzer%2Fmodellr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aichholzer","download_url":"https://codeload.github.com/aichholzer/modellr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451666,"owners_count":20940944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["database-connection","database-management","database-schemas","manager","models","sequelize"],"created_at":"2024-08-08T02:01:19.661Z","updated_at":"2025-10-16T16:43:22.282Z","avatar_url":"https://github.com/aichholzer.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# modellr\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/aichholzer/modellr.svg)](https://greenkeeper.io/)\n[![npm version](https://badge.fury.io/js/modellr.svg)](https://badge.fury.io/js/modellr)\n[![Build Status](https://travis-ci.org/aichholzer/modellr.svg?branch=master)](https://travis-ci.org/aichholzer/modellr)\n[![Downloads](https://img.shields.io/npm/dt/modellr.svg)](https://www.npmjs.com/package/modellr)\n\n\n\u003e Database connection manager for Sequelize.\u003cbr /\u003e`modellr` will also load your models and map them to the DB instance, making them available throughout your application.\n\n#### Install\n\n```\n$\u003e npm i modellr\n```\n\n#### Basic example\n\n```\nconst m = require('modellr');\nconst config = {\n  database: 'database',\n  username: 'username',\n  password: 'password',\n  dialect: 'postgres',\n  logging: false\n}\n\nm.load(config, './models/').then(() =\u003e {\n  // Start your application.\n  // You have a persisted DB connection.\n});\n```\n\nHave a look at the models in `test/models` to see how they should be defined.\n\n#### Usage\n\nYou models are available throughout your application, simply require `modellr` and access whatever model you need.\n\nIf, for example, you have a model named `User`, you may use it like so:\n\n```\nconst m = require('modellr');\n\nm.User.findById(123).then((user) =\u003e {\n  // \"user\" is your record.\n});\n```\n\nAll models export the basic Sequelize usage/functionality as documented [here](http://docs.sequelizejs.com/manual/tutorial/models-usage.html).\n\n#### API\n\n`.load(config, models)` : Prepare the DB connections (as Sequelize instance) and load all model definitions. Note that this method will read all model definitions files, thus it should only be called once, at application launch.\n\n`.instance(alias || null)` : Use a particular instance. If the argument is `null` then the first valid instance will be used.\n\n`.close(alias || null)` : Close DB connections and terminate the corresponding Sequelize instance. If the argument is `null` then all open connections will be terminated.\n\n#### Test\n\n```\n$\u003e npm test\n```\n\n\n#### Contribute\n\n```\nfork https://github.com/aichholzer/modellr\n```\n\n\n#### License\n\n[MIT](https://github.com/aichholzer/modellr/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faichholzer%2Fmodellr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faichholzer%2Fmodellr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faichholzer%2Fmodellr/lists"}