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 🙏

© 2024 – Pkg Stats / Ryan Hefner

7tr

v0.0.1

Published

Cloudflare page plugin for tRPC

Downloads

6

Readme

tRPC Pages Plugin

This plugin allows developers to create tRPC server on Cloudflare Page Function rapidly.

You can see demo site on https://cloudflare-pages-plugin-trpc.pages.dev.

Warning

This plugin is on [email protected]. It's still in alpha, expect bugs and there're lots of breaking changes.

How to use

If you have any tRPC router, just set it into this plugin!

For example, you have router as like as below:

// router.ts
import * as trpc from "@trpc/server";

export const router = trpc.router().query("hello", {
  input: z.string().nullish(),
  resolve: ({ input }) => {
    return `hello ${input ?? "world"}`;
  },
});
export type AppRouter = typeof appRouter;

You can deploy it to Cloudflare Pages Function right now.

import { router } from "./router.ts";
import tRPCPlugin from 'cloudflare-pages-plugin';

// That's it!
export const onRequest: PagesFunction = tRPCPlugin({ router });

More practical code deployed to the demo site can be found in the /examples folder.

What is tRPC ?

tRPC is library that allows End-to-end typesafe APIs made easy. There are many resource to explain tRPC concept, history and what it try to resolve, but I highly recommend that you try to quick demo first.

Of course, you can see tRPC document on trpc.io.

Why this plugin provide as individual package ?

I've sometimes contributed tRPC, so I also created a pull request that this plugin into tRPC package, and I discussed @KATT who creator of tRPC and @sachinraja who maintainer of tRPC, and result, it's prefer to provide as individual package.

So, I'll continue to actively follow and maintain tRPC updates.

Road map

High

  • Write documents

    • deploy guide
  • Integrate Cloudflare resources

    • R2
    • D1
    • And more...

Middle

  • Testing

    I'm considering how test it.