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

ngx-trpc

v1.14.0

Published

Angular integration for tRPC

Readme

Angular tRPC Client 🚀

Features

  • Full Type Safety: Enjoy end-to-end type safety for all your API calls.
  • SSR-Ready: Optimized for Angular Universal and Server-Side Rendering (SSR).
  • Reactive Streams: Utilize RxJS for handling API responses and WebSocket streams like a pro.
  • Subscriptions: Native support for subscriptions using WebSockets, fully integrated with RxJS.

Table of Contents

Inspiration 💡

This project was inspired by the amazing work of Dafnik/ngx-trpc and @analogjs/trpc. It builds upon the same principles of type-safe API communication and seamless Angular integration, with added features such as WebSocket subscriptions.

Disclaimer ⚠️

Since the REQUEST token is reintroduced in v19, this library is compatible only with that version.

This project is a work in progress. Features and APIs may change as development continues. Use at your own risk, and expect frequent updates. Contributions and feedback are always welcome!


Getting Started 🚀

To start using the Angular tRPC Client in your project, install it via npm:

npm i ngx-trpc

Step 1: Create a Global Injection Token

First, define a global injection token using the AppRouter type from your tRPC backend. This will allow you to inject your tRPC client throughout your Angular app.

import { createTrpcInjectionToken } from 'ngx-trpc';

export const TRPC = createTrpcInjectionToken<AppRouter>();

Step 2: Add tRPC Configuration to app.config.ts

Next, provide the tRPC client and httpClient in your app.config.ts file. (example)

import { provideTrpc } from 'ngx-trpc';

provideHttpClient(withFetch())
provideTrpc(TRPC, { options })

Step 3: Use Queries as RxJS Observables in Components

You can now use the TRPC injection token to call tRPC queries as RxJS observables inside your components. Here's an example of how to call the hello query.

import { TRPC } from '../path/to/injection-token';

@Component({
  selector: 'app-demo',
  template: '{{ demoQuery$ | async | json }}',
})
export class DemoComponent {
  readonly trpc = inject(TRPC);
  
  readonly demoQuery$ = this.trpc.hello.query();
}

Known Issues

  • Headers are not forwarded when performing requests in ssr.

    Add this provider to your app.config.server.ts file to fix this issue:

    provideServerRoutesConfig([{path: '**', renderMode: RenderMode.Server}])

TODOs 📝

  • [ ] Additional Unit Tests for SSR and WebSocket Subscriptions.
  • [ ] Improve Error Handling and Logging.
  • [ ] Handle subscriptions server-side. Currently, subscriptions are only supported client-side.