{"id":22489260,"url":"https://github.com/michealroberts/trpc-nitro-adapter","last_synced_at":"2025-11-01T16:30:28.467Z","repository":{"id":167540028,"uuid":"642994430","full_name":"michealroberts/trpc-nitro-adapter","owner":"michealroberts","description":"A tRPC adapter for the nitro web server framework.","archived":false,"fork":false,"pushed_at":"2024-04-12T13:47:50.000Z","size":209,"stargazers_count":40,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-13T17:54:03.899Z","etag":null,"topics":["h3","nitro","nuxt","trpc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michealroberts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-05-19T20:34:55.000Z","updated_at":"2024-07-17T15:38:46.274Z","dependencies_parsed_at":"2023-11-22T18:31:59.503Z","dependency_job_id":"b7f8811a-3fee-4d29-aa4c-09f0cc694405","html_url":"https://github.com/michealroberts/trpc-nitro-adapter","commit_stats":null,"previous_names":["michealroberts/trpc-nitro-adapter"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Ftrpc-nitro-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Ftrpc-nitro-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Ftrpc-nitro-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Ftrpc-nitro-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michealroberts","download_url":"https://codeload.github.com/michealroberts/trpc-nitro-adapter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239301979,"owners_count":19616451,"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":["h3","nitro","nuxt","trpc"],"created_at":"2024-12-06T17:19:31.554Z","updated_at":"2025-11-01T16:30:28.270Z","avatar_url":"https://github.com/michealroberts.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# tRPC.io Nitro Adapter\n\nA [tRPC](https://trpc.io) adapter for the [nitro](https://nitro.unjs.io) web server framework.\n\n## Requirements\n\n- [tRPC](https://trpc.io) v10._._\n- [nitro](https://nitro.unjs.io) v.2.4.\\* or higher\n- [h3](https://github.com/unjs/h3) v.1.6.\\* or higher\n\n## Installation\n\n```bash\nnpm install trpc-nitro-adapter\n```\n\n```bash\npnpm add trpc-nitro-adapter\n```\n\n```bash\nyarn add trpc-nitro-adapter\n```\n\n## Usage\n\nFirst of all you need a router to handle your queries, mutations and subscriptions.\n\nA sample router is given below, saved in in a file named `.trpc/router.ts`\\*. Note, if your router file starts getting too big, split your router into several subrouters each implemented in its own file. Then merge them into a single root appRouter.\n\nTo read more about how to define a router, please consult the [tRPC router documentation](https://trpc.io/docs/server/routers#defining-a-router).\n\n```typescript\n// file: ./trpc/router.ts\n\nimport { initTRPC } from '@trpc/server'\n\nexport const t = initTRPC.create()\n\nexport const appRouter = t.router({\n  // ... define your routes here\n})\n\n// Export your type definition for use in the adapter:\nexport type AppRouter = typeof appRouter\n```\n\nPlease consult the [tRPC documentation](https://trpc.io/docs/server/routers#defining-a-router) for more information on how to create a router.\n\nThen, in your nitro server, create a file in your routes directory named `[...trpc].ts` to ensure that the trpc param is passed to your nitro eventHandler.\n\n```typescript\n// file: /routes/[...trpc].ts\n\n// Import your router:\nimport { appRouter } from './trpc/router.ts'\n\nimport { defineNitroTRPCEventHandler } from 'trpc-nitro-adapter'\n\n// Export as default the defineNitroTRPCEventHandler function:\nexport default defineNitroTRPCEventHandler({\n  router: appRouter,\n  createContext: () =\u003e {\n    // Return your custom defined context here:\n    return {}\n  }\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichealroberts%2Ftrpc-nitro-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichealroberts%2Ftrpc-nitro-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichealroberts%2Ftrpc-nitro-adapter/lists"}