npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nestjs-trpc-v2

v1.4.1

Published

A maintained fork of nestjs-trpc - End-to-end typesafe APIs with tRPC in NestJS

Downloads

1,880

Readme


⚠️ Important Notice: This is a maintained fork of the original nestjs-trpc by Kevin Edry. The original repository is no longer actively maintained. This fork continues development with modern tooling, updated dependencies, and ongoing support.


Introduction

nestjs-trpc-v2 is a library designed to integrate the capabilities of tRPC into the NestJS framework. It provides native support for decorators and implements an opinionated approach that aligns with NestJS conventions.

This v2 fork includes:

  • 🔄 Active maintenance and updates
  • 📦 Turborepo monorepo structure
  • 🚀 Modern build tooling
  • 🔒 Updated dependencies with security patches
  • ✅ Automated CI/CD workflows

Features

  • ✅  Supports most tRPC features out of the box with more to come.
  • 🧙‍  Full static typesafety & autocompletion on the client, for inputs, outputs, and errors.
  • 🙀  Implements the Nestjs opinionated approach to how tRPC works.
  • ⚡️  Same client-side DX - We generate the AppRouter on the fly.
  • 🔋  Examples are available in the ./examples folder.
  • 📦  Out of the box support for Dependency Injection within the routes and procedures.
  • 👀  Native support for express, fastify, and zod with more drivers to come!

Quickstart

Installation

To install nestjs-trpc-v2 with your preferred package manager, you can use any of the following commands:

# npm
npm install nestjs-trpc-v2 zod @trpc/server

# pnpm
pnpm add nestjs-trpc-v2 zod @trpc/server

# yarn
yarn add nestjs-trpc-v2 zod @trpc/server

Peer Dependencies

Make sure you have the following peer dependencies installed:

  • @nestjs/common (^9.3.8 || ^10.0.0 || ^11.0.0)
  • @nestjs/core (^9.3.8 || ^10.0.0 || ^11.0.0)
  • @trpc/server (^10.0.0 || ^11.0.0)
  • reflect-metadata (^0.1.13 || ^0.2.0)
  • rxjs (^7.8.1)
  • zod (^3.14.0 || ^4.0.0)

How to use

Here's a brief example demonstrating how to use the decorators available in nestjs-trpc-v2:

// users.router.ts
import { Inject } from '@nestjs/common';
import { Router, Query, UseMiddlewares } from 'nestjs-trpc-v2';
import { UserService } from './user.service';
import { ProtectedMiddleware } from './protected.middleware';
import { TRPCError } from '@trpc/server';
import { z } from 'zod';

const userSchema = z.object({
  name: z.string(),
  password: z.string(),
});

@Router()
class UserRouter {
  constructor(@Inject(UserService) private readonly userService: UserService) {}

  @UseMiddlewares(ProtectedMiddleware)
  @Query({ output: z.array(userSchema) })
  async getUsers() {
    try {
      return this.userService.getUsers();
    } catch (error: unknown) {
      throw new TRPCError({
        code: 'INTERNAL_SERVER_ERROR',
        message: 'An error has occured when trying to get users.',
        cause: error,
      });
    }
  }
}

👉 For more examples and detailed documentation, see NestJS-tRPC-v2.io. 👈

Development

This project uses Turborepo for managing the monorepo.

Prerequisites

  • Node.js >= 18
  • pnpm >= 10.0.0

Setup

# Clone the repository
git clone https://github.com/mguay22/nestjs-trpc-v2.git
cd nestjs-trpc-v2

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run development mode
pnpm dev

Contributing

Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

Credits & License

Original Library

nestjs-trpc-v2 is a maintained fork of nestjs-trpc, originally developed by Kevin Edry. The original library took huge inspiration from both NestJS and tRPC inner workings.

Original Contributors

This Fork

This fork is maintained by Michael Guay and the community.

License

MIT - See LICENSE file for details.


⭐ If this library helps you, please consider giving it a star!

For questions or support: