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 🙏

© 2025 – Pkg Stats / Ryan Hefner

grpc-wasm

v0.0.2

Published

> Currently, only the Go API is available.

Readme

grpc-wasm

Currently, only the Go API is available.

Deploy your gRPC server as WebAssembly (WASM) and communicate with browser-side JavaScript.

Why is this needed? I was just tired of having to spin up a separate gRPC server every time I test the UI.

Features

  • [x] Unary call
  • [x] Server streaming call
  • [x] Client streaming call
  • [x] Bi-directional streaming call
  • [x] Support transport implementation for connectrpc/connect-es
  • [x] Support transport implementation for timostamm/protobuf-ts

Usage

Server

import (
	grpcwasm "github.com/lesomnus/grpc-wasm"
	"google.golang.org/grpc"
)

func main() {
	s := grpc.NewServer()
	// Register your gRPC service server implementation
	// e.g.
	//  echo.RegisterEchoServiceServer(s, echo.EchoServer{})

	grpcwasm.Serve(s)
}

Neat! I call this program a bridge because it exposes the socket to your gRPC server to the browser.

Assuming your bridge code is located at ./cmd/bridge, build it into WASM:

GOOS=js GOARCH=wasm go build -o ./bridge.wasm ./cmd/bridge

Client

import { open } from "grpc-wasm";

const sock = await open('path/to/your/bridge.wasm')
const conn = await sock.dial()

const msg: Echo = {
	message: "Royale with Cheese",
	circularShift: 6n
};
const req = Echo.toBinary(msg)
const rst = await conn.invoke("/echo.EchoService/Once", req, {});
const res = Echo.fromBinary(rst.response);

console.log(res.message)
// "Cheese Royale with "

await conn.close()
await sock.close()

Bundle with Vite

import { open } from "grpc-wasm";
import workerUrl from "grpc-wasm/worker?worker&url";

const sock = await open('path/to/your/bridge.wasm', { workerUrl })
...

It works for both development and production build.

with connectrpc/connect-es

import { createClient } from "@connectrpc/connect";
import { open } from "grpc-wasm";
import { GrpcWasmTransport } from "grpc-wasm/@connectrpc";

const sock = await open('path/to/your/bridge.wasm')
const conn = await sock.dial()
const transport = new GrpcWasmTransport({ conn });

const client = createClient(EchoService, transport);
const response = await client.Once({
	message: "Royale with Cheese",
	circularShift: 6n
})

console.log(response.message)
// "Cheese Royale with "

with timostamm/protobuf-ts

import { open } from "grpc-wasm";
import { GrpcWasmTransport } from "grpc-wasm/@protobuf-ts";

const sock = await open('path/to/your/bridge.wasm')
const conn = await sock.dial()
const transport = new GrpcWasmTransport({ conn });

const client = new EchoServiceClient(transport);
const { response } = await client.Once({
	message: "Royale with Cheese",
	circularShift: 6n
})

console.log(response.message)
// "Cheese Royale with "

with Vite

You have to add following option to your Vite config:

ref: vitejs/vite#15547

definedConfig({
	// ...
	optimizeDeps: {
		exclude: ["grpc-wasm"],
	},
})

Architecture

flowchart LR
    subgraph Worker
		subgraph "WASM (bridge)"
			Server --- bufconn
		end
		bufconn --- Sock
    end

	Sock --- Conn