{"id":15043979,"url":"https://github.com/mojotech/entwine","last_synced_at":"2025-08-16T17:04:41.773Z","repository":{"id":57225786,"uuid":"47704077","full_name":"mojotech/entwine","owner":"mojotech","description":"Immutable dependency injection in Node.js ","archived":false,"fork":false,"pushed_at":"2015-12-15T15:27:00.000Z","size":14,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-08-09T05:38:33.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mojotech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-09T16:32:32.000Z","updated_at":"2015-12-09T20:42:46.000Z","dependencies_parsed_at":"2022-08-24T11:00:33.743Z","dependency_job_id":null,"html_url":"https://github.com/mojotech/entwine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mojotech/entwine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojotech%2Fentwine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojotech%2Fentwine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojotech%2Fentwine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojotech%2Fentwine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mojotech","download_url":"https://codeload.github.com/mojotech/entwine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojotech%2Fentwine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269699688,"owners_count":24461219,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-09-24T20:49:54.493Z","updated_at":"2025-08-16T17:04:41.749Z","avatar_url":"https://github.com/mojotech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eEntwine\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#logo\"\u003e\n    \u003cimg align=\"center\" src=\"logo.png\" alt=\"Entwine\" height=\"80px\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nImmutable dependency injection in Node.js inspired (very) heavily by [Component](https://github.com/stuartsierra/component).\n\n## Installation ##\n\n```shell\nnpm install --save entwine\n```\n\n## Usage ##\n\n```javascript\nlet entwine = require('entwine');\n\n//\n// Database component\n//\n\nclass Database extends entwine.component({config: {}, conn: null}) {\n  start() {\n    let self = this;\n\n    return connectToDatabase(this.config).then(conn =\u003e self.set('conn', conn));\n  }\n\n  stop() {\n    let self = this;\n\n    return disconnectFromDatabase(this.conn).then(() =\u003e self.remove('conn'));\n  }\n}\n\nfunction database(config) {\n  return new Database({config: config});\n}\n\n//\n// Server component\n//\n\nclass Server extends entwine.component({config: {}, socket: null, database: null}) {\n  start() {\n    let self = this;\n\n    return listenOnPort(this.config).then(socket =\u003e self.set('socket', socket));\n  }\n\n  stop() {\n    let self = this;\n\n    return unlistenOnPort(this.config).then(() =\u003e self.remove('socket'));\n  }\n}\n\nfunction server(config) {\n  return new Server({config: config});\n}\n\n//\n// System\n//\n\nentwine.system({\n  server: server(serverConfig),\n  database: database(databaseConfig)\n},{\n  server: ['database']\n}).start().then(s =\u003e {\n  console.log('system started');\n  return s.stop();\n}).then(() =\u003e {\n  console.log('system stopped');\n});\n\n```\n\n## Testing ##\n\n```shell\nnpm test\n```\n\n## License ##\n\nCopyright (c) 2015 [MojoTech](https://mojotech.com)\n\nEntwine is free software, and may be redistributed under the terms specified in the [LICENSE](LICENSE.txt) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojotech%2Fentwine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmojotech%2Fentwine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojotech%2Fentwine/lists"}