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

@typed-rpc/rpc

v0.2.0

Published

Define a strongly-typed RPC client in TypeScript to streamline communication between front-end and back-end systems with ease and reliability.

Downloads

107

Readme

typed-rpc

Define a strongly-typed RPC client in TypeScript to streamline communication between front-end and back-end systems with ease and reliability.

Features

  • Type-Safe API Integration: Simplify access to back-end APIs for front-end applications with full TypeScript support.
  • Seamless Microservice Communication: Enable clear and efficient communication between back-end microservices with strong typing.
  • Cross-Platform Compatibility: Built on Web Standards, ensuring compatibility with any JavaScript runtime, including Node.js, Deno, Bun, Vercel, and other cloud platforms.
  • Developer-Friendly: Enhance productivity by reducing boilerplate code and minimizing runtime errors through compile-time type checking.
  • Flexible and Extensible: Easily adapt to various back-end frameworks and extend functionality as your application grows.

Plugins

Get Started

First, create a sever in any programming language and framework you want. The following example is built with express.js in TypeScript.

import express, { Router } from "express"
import { z } from "zod"
import validate from "express-zod-safe"

const app = express()
app.use(express.json())
app.get("/ping", async (req, res) => {
  res.status(200).send("pong").end()
})
const chat = Router()
app.use("/chat", chat)
chat.post("/send-message", validate({
  body: z.object({
    content: z.string(),
  }),
}), (req, res) => {
  const { content } = req.body
  const success = Math.random() < 0.8
  res.status(200).send(success ? {
    success: true,
    data: {
      content: content,
    }
  } : {
    success: false,
    error: {
      reason: "randomlyFailed",
    }
  })
})
app.listen(12888)

Then, define the RPC of server-side API and export its type to share with the clients -- you may publish it on a package registry like npm.

import { rpc } from "@typed-rpc/rpc"
import { zValidator } from "@typed-rpc/zod"
import { z } from "zod"

const rpcDef = rpc()
  .get("/ping", r => r.text())
  .route("/chat", rpc()
    .post("/send-message",
      zValidator("json", z.object({
        content: z.string(),
      })),
      r => r.json<{
        success: true,
        data: {
          content: string
        }
      } | {
        success: false,
        error: {
          reason: string,
        }
      }>())
  )

export type RpcDefinition = typeof rpcDef

Finally, create a RPC client with the definition type and config the endpoint.

Let's send requests!

import { rpcClient } from "@typed-rpc/rpc"
import { type RpcDefinition } from "./def.js"

const client = rpcClient<RpcDefinition>('http://localhost:12888')

const pingTest = async () => {
  const res = await client.ping.$get()
  if (res.ok) {
    console.log(await res.text())
  } else {
    console.error(`${res.status} ${res.statusText}`)
  }
}

const sendMessageTest = async () => {
  const res = await client.chat["send-message"].$post({
    json: {
      content: "Hello, world!",
    }
  })
  if (res.ok) {
    const data = await res.json()
    if (data.success) {
      console.log(`Succeed to send message "${data.data.content}."`)
    } else {
      console.log(`Failed to send message due to "${data.error.reason}"`)
    }
  } else {
    console.error(`${res.status} ${res.statusText}: ${await res.text()}`)
  }
}

await pingTest()
await sendMessageTest()

Acknowledgement

The package was inspired by Hono's RPC feature.