{"id":16371690,"url":"https://github.com/inaiat/fastify-di-plugin","last_synced_at":"2026-07-18T08:32:02.979Z","repository":{"id":57749694,"uuid":"524794654","full_name":"inaiat/fastify-di-plugin","owner":"inaiat","description":"Simple, unobtrusive depency injection for fastify","archived":false,"fork":false,"pushed_at":"2023-08-17T18:56:22.000Z","size":306,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-12T02:22:12.393Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inaiat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-08-14T22:36:25.000Z","updated_at":"2022-08-14T22:37:23.000Z","dependencies_parsed_at":"2024-11-08T10:53:50.495Z","dependency_job_id":null,"html_url":"https://github.com/inaiat/fastify-di-plugin","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/inaiat/fastify-di-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaiat%2Ffastify-di-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaiat%2Ffastify-di-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaiat%2Ffastify-di-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaiat%2Ffastify-di-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inaiat","download_url":"https://codeload.github.com/inaiat/fastify-di-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaiat%2Ffastify-di-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35612560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-18T02:00:07.223Z","response_time":61,"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-10-11T03:09:19.817Z","updated_at":"2026-07-18T08:32:02.964Z","avatar_url":"https://github.com/inaiat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastify-di-plugin\n\nA dependency injection plugin for fastify framework, using [awilix](https://github.com/jeffijoe/awilix)\n\nMotivation: I really wanted use [fastify-awilix](https://github.com/fastify/fastify-awilix) but this plugin make things statics. So, basically, this plugin can be used without problem with parallel tests and so on. \n\n## Getting started\n\n```bash\nyarn add @inaiat/fastify-di-plugin awilix\n```\n\nNext, set up the plugin:\n```ts\nimport { fastifyAwilixPlugin } from '@inaiat/fastify-di-plugin'\n```\n\nNext, set up the plugin:\n```ts\ndeclare module '@inaiat/fastify-di-plugin' {\n  interface Cradle {\n    dateService: Date\n    printDate: string\n  }\n}\n\nconst dateService = () =\u003e new Date();\nconst printService = ({dateService: Date}) =\u003e dateService().toDateString()\n\nfastify.register(fastifyDiPlugin, {\n      module: {\n        dateService: asFunction(dateService).singleton(),\n        printDate: asFunction(printService).singleton()\n}})\n\nserver.get(\n      '/status',\n      async (request) =\u003e {\n        const cradle = request.diScope.cradle\n        return cradle.printDate\n      }\n    )\n    \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaiat%2Ffastify-di-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finaiat%2Ffastify-di-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaiat%2Ffastify-di-plugin/lists"}