nest icon indicating copy to clipboard operation
nest copied to clipboard

Feature Request: Native tRPC Support in NestJS

Open matteotomicic opened this issue 5 months ago • 8 comments

Is there an existing issue that is already proposing this?

  • [x] I have searched the existing issues

Is your feature request related to a problem? Please describe it

Currently, NestJS does not have native tRPC support. Developers who want to use tRPC with NestJS need to rely on community packages or create custom integrations, which often lack full compatibility with NestJS features like interceptors, guards, and decorators. This adds extra setup complexity and increases maintenance overhead.

Describe the solution you'd like

I would like to see first-class tRPC support in NestJS, similar to the existing GraphQL module.

This would mean:

  • Official @nestjs/trpc package with smooth integration.
  • Full compatibility with NestJS middleware, interceptors, guards, and dependency injection.
  • Built-in tooling to auto-generate and consume tRPC routers without extra boilerplate.

Such native support would enable developers to use tRPC’s type-safe, end-to-end approach with the productivity and structure of NestJS.

Teachability, documentation, adoption, migration strategy

Adoption could be straightforward:

  • Provide official documentation with setup examples (both monorepo and microservice scenarios).
  • Include migration guides for existing REST or GraphQL projects wanting to switch to tRPC.
  • Offer examples on how to integrate with authentication, authorization, validation, and real-time features in NestJS.

Clear docs and examples would make it easy for developers to start using tRPC in new projects and gradually migrate existing APIs.

What is the motivation / use case for changing the behavior?

tRPC is becoming increasingly popular in the TypeScript ecosystem because it enables type-safe, end-to-end APIs without the need for OpenAPI/Swagger or GraphQL schemas.

Native support in NestJS would:

  • Reduce boilerplate and integration complexity.
  • Allow developers to combine NestJS’ powerful architecture with tRPC’s DX advantages.
  • Make it easier for teams to adopt NestJS when they prefer tRPC over REST or GraphQL.

This would improve developer experience, speed up API development, and expand NestJS’ appeal to a growing segment of the TypeScript community.

matteotomicic avatar Aug 12 '25 06:08 matteotomicic

See #10046

micalevisk avatar Aug 12 '25 15:08 micalevisk

See #10046

It’s been more than two years since then. Things might have changed, considering that more and more communities are now using tRPC.

matteotomicic avatar Aug 12 '25 17:08 matteotomicic

my main concern is regarding the APIs and new abstractions that we would have to create in order to bring the full potential of tRPC into nestjs. You didn't suggest anything about that so I'm taking into account the comments made by @BrunnerLivio and @jmcdo29 and also the discussions at https://discord.gg/nestjs

Image

micalevisk avatar Aug 12 '25 17:08 micalevisk

Perhaps you can find some of the answers you’re looking for here. https://www.nestjs-trpc.io/

It seems to be heading in a good direction, but since it’s not official, no one can know for sure whether support for it will eventually end. That’s why it would be a better option if NestJS had native tRPC support.

matteotomicic avatar Aug 12 '25 19:08 matteotomicic

btw there is another one 3rd-party lib for nestjs+trpc: https://natansal.github.io/NestRPC-docs/ (@nestjs-rpc/*)

micalevisk avatar Aug 26 '25 13:08 micalevisk

Perhaps you can find some of the answers you’re looking for here. https://www.nestjs-trpc.io/

It seems to be heading in a good direction, but since it’s not official, no one can know for sure whether support for it will eventually end. That’s why it would be a better option if NestJS had native tRPC support.

This library has not been maintained for a long time, although it is the best available in this area.

Ricorder avatar Oct 12 '25 05:10 Ricorder

nestjs-trpc Is this project dead?

We could also consider ts-rest as another alternative.

https://github.com/ts-rest/ts-rest

  • https://ts-rest.com/server/nest

CatsMiaow avatar Oct 13 '25 02:10 CatsMiaow

hey  ,I want to work on this issue, please assign me under the hacktoberfest 2025 . I would really appreciate for it. Thanks!!!

DancingPeacock-31 avatar Oct 22 '25 19:10 DancingPeacock-31