{"repo":"Evyweb/ioctopus","free":true,"listed":false,"github":"https://github.com/Evyweb/ioctopus","clone":"git clone https://github.com/Evyweb/ioctopus.git","description":"TS IoC container – lightweight, framework-agnostic, React/Next.js (Node+Edge) ready.","language":"TypeScript","stars":86,"topics":["ioc-container","nextjs","clean-architecture","dependency-injection","dependency-management","developer-tools","edge-runtime","framework-agnostic","lightweight","nodejs"],"license":"MIT","category":"dev-tools","readme_excerpt":"A simple IoC container for TypeScript Introduction An IoC (Inversion of Control) container for TypeScript. The idea behind it is to create a simple container that can register and resolve dependencies for classes and functions without relying on reflect metadata. It uses plain TypeScript code, so it can be added to any project without additional dependencies. It also works in Next.js middleware and Node and Edge runtimes. Installation How to use To use ioctopus, you need to create a container and bind your dependencies. To do so, you need to create an ID for each dependency you want to register. This ID, which we call an \"injection token,\" can be a string or a symbol. (Please note that you must be consistent: either always use strings for binding and resolving dependencies or always use symbols; you can't mix them.) Then you can bind the dependency to a value, a function, a class, a factory, a higher-order function, or a curried function. Type-Safe Registry (Recommended) Note: Using a type-safe registry is the recommended approach for better type safety and developer experience. You can define a registry type or interface to get full type safety for your dependency injection keys and their corresponding types. This eliminates the need for manual casting when resolving dependencies. The container also validates that the dependencies you provide match what your classes or functions expect. TypeScript will catch errors at compile time such as omitting required dependencies or pr","default_branch":null,"files":null,"tree":[],"storefront":"/r/Evyweb","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Evyweb/ioctopus/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}