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

@openknot-ts/trpc-knot-server-handler

v0.0.6-preview

Published

tRPC HTTP handler binding for the Knot HTTP host.

Readme

@openknot-ts/trpc-knot-server-handler

The tRPC handler for the Node host of @openknot-ts/knot-http-node. It serves the routers of @openknot-ts/trpc-router with the context of @openknot-ts/trpc-context.

Usage

import { http } from "@openknot-ts/knot-http-node";
import { trpcHttp } from "@openknot-ts/trpc-knot-server-handler";
import { trpcRouter } from "@openknot-ts/trpc-router";
import { defineApplication, providePlugs } from "@openknot-ts/wire";

const router = trpcRouter({
  routes: ({ trpc }) => ({ hello: trpc.procedure.query(() => "Hello!") }),
});

export const application = defineApplication({
  modules: [providePlugs([router]), http, trpcHttp],
});

An application selects one handler, trpcHttp or its own; two implementations of the handler contract fail at startup.

API

| Export | Description | | --- | --- | | trpcHttp | Ready module: merges the selected routers and implements the host's httpHandler. | | trpcHttpHandler | Its handler unit. | | trpcHttpOptions | Native handler options, default { basePath: "/trpc/" }; rebind with unit({ provides: trpcHttpOptions, ... }). | | trpcHttpConfig | The default environment configuration. | | nodeTrpcHandler({ requirements?, options? }) | A handler over the merged routers with native TrpcHttpOptions from the application's own config. | | trpcHandler({ router, createContext?, requirements?, options?, ...nativeOptions }) | A handler for custom typed routers and contexts. |

Pass a custom handler to nodeHttpServer({ handler }) and select that host instead of http and trpcHttp. Custom handlers do not bind the shared contract, so several can run on separate servers.

Configuration

| Variable | Default | Meaning | | --- | --- | --- | | TRPC_BASE_PATH | /trpc/ | Mount path; must start with /. Requests outside it answer 404. | | TRPC_MAX_BODY_SIZE | tRPC default | Body limit in bytes; Infinity removes it. |

Environment values override trpcHttpOptions. An options callback replaces this configuration entirely:

const handler = nodeTrpcHandler({
  requirements: { settings },
  options: ({ settings }) => ({ basePath: settings.RPC_PATH, maxBodySize: settings.RPC_LIMIT }),
});

Bodies, batching, streaming, SSE cancellation and errors stay native tRPC. WebSocket adapters attach to the host's native server. Health probes come from @openknot-ts/knot-health; on Fastify use @openknot-ts/trpc-fastify.

Tests

pnpm --filter @openknot-ts/trpc-knot-server-handler test covers router collection, typing, configuration, mount boundaries, large bodies, batch streaming, SSE cancellation and real WebSocket clients.