{"id":49585,"library":"typescript-rest-ioc","title":"typescript-rest-ioc","description":"Service factory to integrate typescript-rest with typescript-ioc for dependency injection in REST services. Current stable version: 1.0.1. It enables IoC features like @Inject, request scopes, and DI in typescript-rest routes. This package acts as a bridge; you must install typescript-rest and typescript-ioc separately. Differentiator: seamless integration with typescript-ioc's container, allowing constructor injection and scoped services. Maintenance mode: last release was in 2020, no recent updates.","status":"maintenance","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/thiagobustamante/typescript-rest-ioc","tags":["javascript","typescript-rest","rest","ioc","di","cdi","typescript","node"],"install":[{"cmd":"npm install typescript-rest-ioc","lang":"bash","label":"npm"},{"cmd":"yarn add typescript-rest-ioc","lang":"bash","label":"yarn"},{"cmd":"pnpm add typescript-rest-ioc","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: provides the IoC container used by the service factory","package":"typescript-ioc","optional":false},{"reason":"Peer dependency: the REST framework that the factory integrates with","package":"typescript-rest","optional":false}],"imports":[{"note":"This package is not directly imported in user code. It is referenced via the rest.config file's serviceFactory field. No named export exists.","wrong":"import { serviceFactory } from 'typescript-rest-ioc'","symbol":"default","correct":"import serviceFactory from 'typescript-rest-ioc' (not a typical user import; set in config)"},{"note":"Server comes from typescript-rest, not this package.","wrong":"import { Server } from 'typescript-rest-ioc'","symbol":"typescript-rest/Server","correct":"import { Server } from 'typescript-rest'"},{"note":"Container comes from typescript-ioc, not this package.","wrong":"import { Container } from 'typescript-rest-ioc'","symbol":"typescript-ioc/Container","correct":"import { Container } from 'typescript-ioc'"}],"quickstart":{"code":"// rest.config.json\n{\n  \"serviceFactory\": \"typescript-rest-ioc\"\n}\n\n// install dependencies\n// npm install typescript-rest typescript-ioc typescript-rest-ioc\n\n// service.ts\nimport { Inject } from 'typescript-ioc';\nimport { Path, GET, PathParam } from 'typescript-rest';\n\nclass HelloService {\n  sayHello(name: string): string {\n    return \"Hello \" + name;\n  }\n}\n\n@Path(\"/hello\")\nclass HelloRestService {\n  @Inject\n  private helloService!: HelloService;\n\n  @Path(\":name\")\n  @GET\n  sayHello(@PathParam('name') name: string): string {\n    return this.helloService.sayHello(name);\n  }\n}\n\nexport default HelloRestService;","lang":"typescript","description":"Shows how to configure typescript-rest-ioc via rest.config.json and use @Inject from typescript-ioc in a REST service."},"warnings":[{"fix":"Consider alternatives like inversify or tsyringe with manual integration.","message":"The package has not been updated since v1.0.1 (2020). It may not work with newer versions of typescript-rest or typescript-ioc.","severity":"deprecated","affected_versions":">=1.0.1"},{"fix":"Set serviceFactory in rest.config.json to 'typescript-rest-ioc'.","message":"Do not import anything from typescript-rest-ioc directly. The package is only used as a string in the serviceFactory config.","severity":"gotcha","affected_versions":"*"},{"fix":"Run npm install typescript-rest typescript-ioc typescript-rest-ioc.","message":"The package requires both peer dependencies (typescript-ioc and typescript-rest) to be installed separately. Missing them causes errors at runtime.","severity":"breaking","affected_versions":"*"},{"fix":"Use `private helloService!: HelloService;` to avoid TS2564 error.","message":"TypeScript strict mode may require definite assignment assertion (!) on injected properties.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'1.0.1':25 '2020':79 'act':43 'allow':67 'bridg':46 'cdi':90 'constructor':68 'contain':66 'current':22 'depend':17 'di':35,89 'differenti':58 'enabl':27 'factori':6 'featur':29 'inject':18,31,69 'instal':49 'integr':8,60 'ioc':4,15,28,56,64,88 'javascript':83 'last':75 'like':30 'mainten':73 'mode':74 'must':48 'node':92 'packag':42 'recent':81 'releas':76 'request':32 'rest':3,11,20,39,52,86,87 'rout':40 'scope':33,71 'seamless':59 'separ':57 'servic':5,21,72 'stabl':23 'typescript':2,10,14,38,51,55,63,85,91 'typescript-ioc':13,54,62 'typescript-rest':9,37,50,84 'typescript-rest-ioc':1 'updat':82 'version':24","created_at":"2026-06-07T17:02:31.335047+00:00","updated_at":"2026-06-07T17:02:31.335047+00:00","problems":[{"fix":"npm install typescript-rest-ioc --save","cause":"Package not installed.","error":"Error: Cannot find module 'typescript-rest-ioc'"},{"fix":"Create rest.config.json with {\"serviceFactory\": \"typescript-rest-ioc\"}","cause":"Service factory is not properly configured or missing rest.config.json.","error":"TypeError: Cannot read property 'get' of undefined"},{"fix":"Add ! after property name: @Inject private helloService!: HelloService;","cause":"TypeScript strict property initialization.","error":"TS2564: Property 'helloService' has no initializer and is not definitely assigned in the constructor."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/thiagobustamante/typescript-rest-ioc#readme","github":"https://github.com/thiagobustamante/typescript-rest-ioc","docs":null,"changelog":null,"pypi":null,"npm":"typescript-rest-ioc","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}