{"id":18351656,"url":"https://github.com/macstr1k3r/trpc-nestjs-adapter","last_synced_at":"2025-04-06T11:32:35.003Z","repository":{"id":65454057,"uuid":"592642842","full_name":"macstr1k3r/trpc-nestjs-adapter","owner":"macstr1k3r","description":"An adapter, allowing you to use TRPC inside of Nest.JS","archived":false,"fork":false,"pushed_at":"2023-10-31T13:35:09.000Z","size":162,"stargazers_count":158,"open_issues_count":5,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-05T21:46:24.283Z","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/macstr1k3r.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":"2023-01-24T07:40:59.000Z","updated_at":"2024-11-02T19:42:07.000Z","dependencies_parsed_at":"2023-02-14T15:01:11.821Z","dependency_job_id":"6fa22c89-14e5-4b3d-8d90-dbcde25d1c4b","html_url":"https://github.com/macstr1k3r/trpc-nestjs-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macstr1k3r%2Ftrpc-nestjs-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macstr1k3r%2Ftrpc-nestjs-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macstr1k3r%2Ftrpc-nestjs-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macstr1k3r%2Ftrpc-nestjs-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macstr1k3r","download_url":"https://codeload.github.com/macstr1k3r/trpc-nestjs-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478151,"owners_count":20945257,"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":[],"created_at":"2024-11-05T21:32:09.672Z","updated_at":"2025-04-06T11:32:34.708Z","avatar_url":"https://github.com/macstr1k3r.png","language":"TypeScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# tRPC - Nest.JS Adapter\n\n- Allows you to use Trpc with Nest.JS.\n- Allows you to use request scoped Nest.JS providers\n- Allows you to use Nest.JS's great module system\n\n\n## Feature support\nI don't use all of the features tRPC has :/ \n\nBoth __queries__ and __mutations__ work. \n\nI __haven't__ tested subscriptions yet.\n\nBatching __doesn't__ work. Currently it't not possible to create multiple requests from 1 single HTTP request in Nest.JS (or it's a skill issue :) )\n\n## How\n\nSee the `example` folder in this repo, but briefly \n\n```bash\nyarn add trpc-nestjs-adapter\n```\n\n`main.ts`\n``` ts \n// Standard  nest.js main.ts\nimport { NestFactory } from '@nestjs/core';\nimport { NestExpressApplication } from '@nestjs/platform-express';\nimport { AppModule } from './app.module';\n\nasync function bootstrap() {\n  const app = await NestFactory.create\u003cNestExpressApplication\u003e(AppModule);\n  await app.listen(3000);\n}\n\nbootstrap();\n```\n\n`app.module.ts`\n```ts\nimport { Module } from '@nestjs/common';\nimport { TrpcModule } from 'trpc-nestjs-adapter';\nimport { rootRouter } from './trpc/root-trpc.router.ts';\nimport { createContext }  from './trpc/create-context.ts';\n\n@Module({\n  imports: [\n    AModule,\n    TrpcModule.forRoot({\n      path: '/trpc',\n      router: rootRouter,\n      createContext,\n    }),\n  ],\n})\nexport class AppModule { }\n\n```\n\n\n### Inside of your procedures\n\n```ts\nexport const exampleMutation = trpc.procedure\n    .input()\n    .mutation(async ({ ctx })=\u003e{\n        const nestService = await ctx.resolveNestDependency(SomeNestService);\n\n        await nestService.someServiceMethod()\n    })\n```\n\n\n#### Note\nThe package is marked `alpha` for a reason, but mostly It's not documented very well.\n\nIf/When/As the package gains traction I'll improve the example \u0026 related docs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacstr1k3r%2Ftrpc-nestjs-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacstr1k3r%2Ftrpc-nestjs-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacstr1k3r%2Ftrpc-nestjs-adapter/lists"}