{"id":25011317,"url":"https://github.com/needle-di/core","last_synced_at":"2025-10-20T01:32:12.452Z","repository":{"id":257579314,"uuid":"858757856","full_name":"needle-di/core","owner":"needle-di","description":"A lightweight, type-safe Dependency Injection (DI) library for JavaScript and TypeScript projects","archived":false,"fork":false,"pushed_at":"2025-01-16T14:26:15.000Z","size":264,"stargazers_count":30,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T14:31:37.595Z","etag":null,"topics":["dependency-injection","typescript"],"latest_commit_sha":null,"homepage":"http://needle-di.io","language":"TypeScript","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/needle-di.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2024-09-17T13:37:35.000Z","updated_at":"2025-01-16T14:26:05.000Z","dependencies_parsed_at":"2024-09-17T14:34:49.354Z","dependency_job_id":"649cf05e-f49c-41ec-80cb-93fdd044806c","html_url":"https://github.com/needle-di/core","commit_stats":null,"previous_names":["dirkluijk/needle-di","needle-di/core"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/needle-di%2Fcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/needle-di%2Fcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/needle-di%2Fcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/needle-di%2Fcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/needle-di","download_url":"https://codeload.github.com/needle-di/core/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237242868,"owners_count":19278061,"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":["dependency-injection","typescript"],"created_at":"2025-02-05T05:02:22.427Z","updated_at":"2025-10-20T01:32:12.441Z","avatar_url":"https://github.com/needle-di.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Needle DI 💉\n\n\u003e A lightweight, type-safe Dependency Injection (DI) library for JavaScript and TypeScript projects.\n\n[![NPM version](http://img.shields.io/npm/v/@needle-di/core.svg)](https://www.npmjs.com/package/@needle-di/core)\n[![JSR version](http://img.shields.io/jsr/v/@needle-di/core.svg)](https://jsr.io/@needle-di/core)\n[![NPM downloads](https://img.shields.io/npm/dm/@needle-di/core)](https://www.npmjs.com/package/@needle-di/core)\n[![Build status](https://img.shields.io/github/actions/workflow/status/needle-di/needle-di/ci.yml?branch=main\u0026style=flat)](https://github.com/needle-di/needle-di/actions/workflows/ci.yml)\n[![Coverage](https://gist.githubusercontent.com/dirkluijk/db6fbd0d0d4c138655a89386c5bdbe41/raw/badge.svg)](https://github.com/needle-di/needle-di/actions/workflows/ci.yml)\n\nNeedle DI is a lightweight, TypeScript-first library for dependency injection (DI). It is designed to be both easy to use and highly efficient.\n\n### Key Features\n\n- Stand-alone: No additional dependencies required\n- Intended for both JavaScript-only and TypeScript projects\n- Supports [tree-shakeable injection tokens](https://needle-di.io/advanced/tree-shaking.html): optimize your builds for production.\n- Inspired by [Angular](https://angular.dev/) and [InversifyJS](https://github.com/inversify/InversifyJS), familiar to developers coming from these frameworks.\n- Uses native [ECMAScript decorators](https://github.com/tc39/proposal-decorators) (currently stage 3)\n- No need for `experimentalDecorators` and `emitDecoratorMetadata`\n- No reflection libraries needed, like `reflect-metadata` or other reflection mechanisms.\n\n## Basic example\n\nHere’s a simple example using constructor injection to inject one service into another.\n\n```typescript\nimport { injectable, inject } from \"@needle-di/core\";\n\n@injectable()\nclass FooService {}\n\n@injectable()\nclass BarService {\n  constructor(private fooService = inject(FooService)) {}\n  //                  ^? Type will be inferred as `FooService`\n}\n```\n\nThe `@injectable` decorator eliminates the need to manually register services. To construct the `BarService`, create a\ndependency injection container, and use the `container.get()` method:\n\n```typescript\nimport { Container } from \"@needle-di/core\";\n\nconst container = new Container();\nconst barService = container.get(BarService);\n//    ^? Type will be inferred as `BarService`\n```\n\nCheck out the [docs](https://needle-di.io/concepts/binding.html) to learn more!\n\n## Installation\n\n```\nnpm install --save @needle-di/core\n```\n\nNeedle DI also works with [Deno](https://deno.com/) and is published to [JSR](https://jsr.io/@needle-di/core) as well:\n\n```bash\ndeno add jsr:@needle-di/core\n```\n\n## Docs\n\nCheck out our docs on [https://needle-di.io](https://needle-di.io/concepts/binding.html).\n\n## License\n\nLicense under the MIT License (MIT)\n\nCopyright (c) 2024 - 2025 Dirk Luijk\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneedle-di%2Fcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneedle-di%2Fcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneedle-di%2Fcore/lists"}