{"_id":"@albertoielpo/ielpify","_rev":"4-41f6e0a7f8da391e008f2e9f616ed0c6","name":"@albertoielpo/ielpify","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@albertoielpo/ielpify","version":"0.1.0","keywords":["fastify","decorators","typescript","nestjs","dependency-injection","di","controllers","routing"],"author":{"name":"Alberto Ielpo","email":"alberto.ielpo@gmail.com"},"license":"MIT","_id":"@albertoielpo/ielpify@0.1.0","maintainers":[{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"}],"homepage":"https://github.com/ielpo/ielpify#readme","bugs":{"url":"https://github.com/ielpo/ielpify/issues"},"dist":{"shasum":"8713fed8e5cd7ff7d3a81eb76f1b313dee4a70e0","tarball":"https://registry.npmjs.org/@albertoielpo/ielpify/-/ielpify-0.1.0.tgz","fileCount":27,"integrity":"sha512-LPnHcrDK9xgl9oh+Ve7WIY4y2ItzWnhRlgD8qSrxAz8fFzs0erSGiP0+y/YPmpQ19eUN67lGynPAvCRjg/Uu7Q==","signatures":[{"sig":"MEUCIQCvL3B/Xr90sGrbrFI0RJuMwajVP6nuTrlsq7kT6ST9+gIgOoLl38zGRX/HT65MBzlaJlyCHRqGyUpyzdpt3qaqWdY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30730},"main":"dist/cjs/index.js","types":"dist/cjs/index.d.ts","module":"dist/esm/index.js","engines":{"npm":">=11","node":">=24"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"gitHead":"7812a38e72eb2c1ebcaf4126abe6525a5f61ff7c","scripts":{"build":"npm run build:cjs && npm run build:esm","format":"prettier --write \"src/**/*.ts\"","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublish":"npm run build"},"_npmUser":{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"},"repository":{"url":"git+https://github.com/ielpo/ielpify.git","type":"git"},"_npmVersion":"11.6.2","description":"A simplified way to build Fastify applications using decorators, inspired by NestJS","directories":{},"_nodeVersion":"24.13.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"~5.7.1","prettier":"~3.6.2","typescript":"~5.9.2","@types/node":"^24.0.0","reflect-metadata":"~0.2.2"},"peerDependencies":{"fastify":">=5.0.0","reflect-metadata":">=0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ielpify_0.1.0_1768754852330_0.3024263130570013","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@albertoielpo/ielpify","version":"0.1.1","keywords":["fastify","decorators","typescript","nestjs","dependency-injection","di","controllers","routing"],"author":{"name":"Alberto Ielpo","email":"alberto.ielpo@gmail.com"},"license":"MIT","_id":"@albertoielpo/ielpify@0.1.1","maintainers":[{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"}],"homepage":"https://github.com/albertoielpo/ielpify#readme","bugs":{"url":"https://github.com/albertoielpo/ielpify/issues"},"dist":{"shasum":"460f00bdd28466d63da28ff697d8dc32eaef6685","tarball":"https://registry.npmjs.org/@albertoielpo/ielpify/-/ielpify-0.1.1.tgz","fileCount":27,"integrity":"sha512-6foBTgHli4Dx0PrBTwnzMPw2vNpvMiIH3XUQXxebjeNd5Ucxq7BFyoNYEjtx5nuIrLf6JLy6XzOiWOjH2b4vTQ==","signatures":[{"sig":"MEUCIHc91v/UFbNw7djkYlqqCc3gTVYJJXHRAONN0v7XFxyHAiEA3Q7421dcr02ZHWVZD7kHfW7DNpQUdPucI8PHuE6wD60=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30737},"main":"dist/cjs/index.js","types":"dist/cjs/index.d.ts","module":"dist/esm/index.js","engines":{"npm":">=11","node":">=24"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"gitHead":"c43f6517ea7d5f889edb85843f082f1550a577a5","scripts":{"build":"npm run build:cjs && npm run build:esm","format":"prettier --write \"src/**/*.ts\"","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublish":"npm run build"},"_npmUser":{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"},"repository":{"url":"git+https://github.com/albertoielpo/ielpify.git","type":"git"},"_npmVersion":"11.6.2","description":"A simplified way to build Fastify applications using decorators, inspired by NestJS","directories":{},"_nodeVersion":"24.13.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"~5.7.1","prettier":"~3.6.2","typescript":"~5.9.2","@types/node":"^24.0.0","reflect-metadata":"~0.2.2"},"peerDependencies":{"fastify":">=5.0.0","reflect-metadata":">=0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ielpify_0.1.1_1768755108072_0.4226035243848594","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@albertoielpo/ielpify","version":"0.2.0","keywords":["fastify","decorators","typescript","nestjs","dependency-injection","di","controllers","routing"],"author":{"name":"Alberto Ielpo","email":"alberto.ielpo@gmail.com"},"license":"MIT","_id":"@albertoielpo/ielpify@0.2.0","maintainers":[{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"}],"homepage":"https://github.com/albertoielpo/ielpify#readme","bugs":{"url":"https://github.com/albertoielpo/ielpify/issues"},"dist":{"shasum":"d2246e7d19f813e4eb8a96e252737c131f57a4b4","tarball":"https://registry.npmjs.org/@albertoielpo/ielpify/-/ielpify-0.2.0.tgz","fileCount":35,"integrity":"sha512-jzvNDXnXVhITvacrGmBM6iPHrQ6e6ox4R33xnvccu9IDVaASx3CLDnLwonMkR3sq7Fyz+AKN2CzS3hoJk/e4cw==","signatures":[{"sig":"MEUCIBuegGVO4dyvsIoBXsNccpg4dTDSsJWAc0KSxN41v6RyAiEAyVNkt09XZEFV18knzbCkI6Y4Qsp+Cq3IxPF6DEQ28NY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55215},"main":"dist/cjs/index.js","types":"dist/cjs/index.d.ts","module":"dist/esm/index.js","engines":{"npm":">=11","node":">=24"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"gitHead":"89d76930eb9564d7619727a2eb86d77d6cf4fdc2","scripts":{"build":"npm run build:cjs && npm run build:esm","format":"prettier --write \"src/**/*.ts\"","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublish":"npm run build"},"_npmUser":{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"},"repository":{"url":"git+https://github.com/albertoielpo/ielpify.git","type":"git"},"_npmVersion":"11.6.2","description":"A simplified way to build Fastify applications using decorators, inspired by NestJS","directories":{},"_nodeVersion":"24.13.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"fastify":"~5.7.1","prettier":"~3.6.2","typescript":"~5.9.2","@types/node":"^24.0.0","reflect-metadata":"~0.2.2"},"peerDependencies":{"fastify":">=5.0.0","reflect-metadata":">=0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ielpify_0.2.0_1768773858841_0.658429312762747","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@albertoielpo/ielpify","version":"0.3.0","description":"A simplified way to build Fastify applications using decorators, inspired by NestJS","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/cjs/index.d.ts","exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"scripts":{"build":"npm run build:cjs && npm run build:esm","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","prepublish":"npm run build","format":"prettier --write \"src/**/*.ts\""},"keywords":["fastify","decorators","typescript","nestjs","dependency-injection","di","controllers","routing"],"author":{"name":"Alberto Ielpo","email":"alberto.ielpo@gmail.com"},"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/albertoielpo/ielpify.git"},"peerDependencies":{"fastify":">=5.0.0","reflect-metadata":">=0.1.0"},"devDependencies":{"@types/node":"^24.0.0","fastify":"~5.7.1","prettier":"~3.6.2","reflect-metadata":"~0.2.2","typescript":"~5.9.2"},"engines":{"node":">=24","npm":">=11"},"gitHead":"1f014f8f9cc661250c57d589e0d6aa4ff7c10532","_id":"@albertoielpo/ielpify@0.3.0","bugs":{"url":"https://github.com/albertoielpo/ielpify/issues"},"homepage":"https://github.com/albertoielpo/ielpify#readme","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-RDjN5m2EGjpIkzKQ2HyX0KHrRIeUsEaFgAuQpS+pOO5uQ4+/mXQ7VfXnUW09oBFzwzqXfD98M5v70qsTszi44A==","shasum":"5519e58f32094142b7dbe220a6d95eb8be48f3bd","tarball":"https://registry.npmjs.org/@albertoielpo/ielpify/-/ielpify-0.3.0.tgz","fileCount":35,"unpackedSize":58522,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBV7WVpFbZkS7UmJlVSceSXb2Z++UHnO19RqTuBG5lQSAiEAlAV6EiOSVeUJjYQEzkke6GFf38bfaC5C5U7zx5TL9o4="}]},"_npmUser":{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"},"directories":{},"maintainers":[{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ielpify_0.3.0_1771743258704_0.9643958394028342"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-18T16:47:32.234Z","modified":"2026-02-22T06:54:18.957Z","0.1.0":"2026-01-18T16:47:32.470Z","0.1.1":"2026-01-18T16:51:48.230Z","0.2.0":"2026-01-18T22:04:19.009Z","0.3.0":"2026-02-22T06:54:18.837Z"},"bugs":{"url":"https://github.com/albertoielpo/ielpify/issues"},"author":{"name":"Alberto Ielpo","email":"alberto.ielpo@gmail.com"},"license":"MIT","homepage":"https://github.com/albertoielpo/ielpify#readme","keywords":["fastify","decorators","typescript","nestjs","dependency-injection","di","controllers","routing"],"repository":{"type":"git","url":"git+https://github.com/albertoielpo/ielpify.git"},"description":"A simplified way to build Fastify applications using decorators, inspired by NestJS","maintainers":[{"name":"albertoielpo","email":"alberto.ielpo@gmail.com"}],"readme":"# @albertoielpo/ielpify\n\nTypeScript decorators for Fastify: controllers, routing, scheduling, and simple dependency injection.\n\n## Installation\n\n```bash\nnpm install @albertoielpo/ielpify\nnpm install reflect-metadata fastify  # peer dependencies\n```\n\n## Decorators\n\n### Routing\n\n- `@Controller(prefix?)` - Define a controller with optional route prefix\n- `@Get(path?)`, `@Post(path?)`, `@Put(path?)`, `@Delete(path?)`, `@Patch(path?)` - HTTP method decorators\n\n### Dependency Injection\n\n- `@Injectable()` - Mark a class as a singleton service\n- `@Inject(ServiceClass)` - Inject a singleton dependency into a constructor parameter\n\n### Scheduling\n\n- `@Timeout(options)` - Schedule a method to run after a delay, optionally repeating\n\n## API Reference\n\n### Routing functions\n\n#### `registerController(fastify, ControllerClass)`\n\nRegisters a controller with a Fastify instance. Creates the controller instance (with DI) and sets up all routes.\n\n```ts\nregisterController(fastify, HomeController);\n```\n\n#### `getControllerInstances()`\n\nReturns all registered controller instances. Useful for applying lifecycle operations such as `startTimeouts`.\n\n```ts\nconst instances = getControllerInstances();\n```\n\n### Dependency Injection functions\n\n#### `resolveService(ServiceClass)`\n\nResolves a singleton service from the DI container. Creates the instance on first call, then returns the same instance on subsequent calls. Throws if the class is not decorated with `@Injectable()`.\n\n```ts\nconst service = resolveService(MyService);\n```\n\n#### `registerService(ServiceClass)`\n\nManually registers a service in the DI container (alias for `resolveService` that discards the return value).\n\n```ts\nregisterService(MyService);\n```\n\n#### `createWithInjection(TargetClass)`\n\nCreates an instance of a class with all `@Inject()`-decorated constructor parameters resolved automatically.\n\n```ts\nconst instance = createWithInjection(MyClass);\n```\n\n#### `isInjectable(TargetClass)`\n\nReturns `true` if the class is decorated with `@Injectable()`.\n\n```ts\nif (isInjectable(MyService)) { ... }\n```\n\n#### `getContainerInstances()`\n\nReturns all service instances currently stored in the DI container. Useful for applying lifecycle operations such as `startTimeouts`.\n\n```ts\nconst instances = getContainerInstances();\n```\n\n### Scheduling functions\n\n#### `startTimeouts(instance)`\n\nStarts all `@Timeout`-decorated methods on a given instance. Call this after all controllers and services are registered.\n\n```ts\n[...getControllerInstances(), ...getContainerInstances()].forEach(startTimeouts);\n```\n\n#### `TimeoutOptions`\n\n| Property | Type     | Default | Description                                      |\n|----------|----------|---------|--------------------------------------------------|\n| `ms`     | `number` | —       | Delay in milliseconds between each execution     |\n| `times`  | `number` | `1`     | Number of executions. Use `-1` for infinite loop |\n\n## Example\n\n```ts\nimport { Injectable, Injectable, Inject, Timeout } from \"@albertoielpo/ielpify\";\n\n@Injectable()\nclass MyService {\n  @Timeout({ ms: 5000, times: 3 })\n  poll() {\n    console.log(\"polling...\");\n  }\n}\n\n@Controller(\"hello\")\nclass HelloController {\n  constructor(\n    @Inject(MyService) private myService: MyService\n  ) {}\n\n  @Get(\"world\")\n  helloWorld(req: FastifyRequest, res: FastifyReply) {\n    return res.send({ message: \"Hello, world!\" });\n  }\n}\n\nconst fastify = Fastify();\nregisterController(fastify, HelloController);\n[...getControllerInstances(), ...getContainerInstances()].forEach(startTimeouts);\nfastify.listen({ port: 3000 });\n```\n\nSee the [example/](./example) folder for a complete working demo.\n\n```bash\ncd example\nnpm install\nnpm run dev\n```\n\n## Development\n\nTo test changes locally without publishing:\n\n```bash\nnpm run build\nmkdir -p example/node_modules/@albertoielpo/ielpify\ncp -R dist example/node_modules/@albertoielpo/ielpify/\ncp package.json example/node_modules/@albertoielpo/ielpify/\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}