# estuary-rpc

> Estuary RPC is a native-TS type safe RPC system for servers and browser clients - this is the code in common for both

Latest version **1.1.0** (published 2026-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install estuary-rpc
pnpm add estuary-rpc
yarn add estuary-rpc
bun add estuary-rpc
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-10-23 |
| First published | 2022-08-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 75 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nolan Hawkins |
| Maintainers | nolanhhawkins |
| Keywords | rpc, server, websocket |

## Links

- npm: https://www.npmjs.com/package/estuary-rpc
- Repository: https://github.com/digitaltembo/estuary-rpc
- Issues: https://github.com/digitaltembo/estuary-rpc/issues
- npm.io page: https://npm.io/package/estuary-rpc

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2026-10-23
- 1.0.6 — 2022-08-24
- 1.0.5 — 2022-08-21
- 1.0.3 — 2022-08-20
- 1.0.2 — 2022-08-20
- 1.0.1 — 2022-08-20
- 1.0.0 — 2022-08-20

## README

# Estuary RPC

Estuary RPC is an attempt to make an extremely simple (toy) RPC system for use between browsers and servers that:

- is typesafe, with all types simply defined in TS - meaning your code won't compile if the server or the client code is not invoked with the correct types for the given RPC call
- supports most desired operations between client and server (REST methods, status codes, file uploads, automatic authentication)
- doesn't have external dependencies

# This Package

`estuary-rpc` defines common types and methods for in turn defining your API in code that is held in 
common between a server and a client. 

# Installation
Should be installed in both your server and client code with
```
npm install estuary-rpc
```

# Usage
Within the common project, it will be necessary to define 3 things:
* The Meta type used to describe all your endpoints. It may be sufficient to use SimpleMeta, in which case the Meta type can simple be left off your endpoint metadata definitions in the next section

* Your API metadata definition. This will use the [get](http://digitaltembo.github.io/estuary-rpc/functions/estuary_rpc.get.html), [post](http://digitaltembo.github.io/estuary-rpc/functions/estuary_rpc.post.html), [put](http://digitaltembo.github.io/estuary-rpc/functions/estuary_rpc.put.html), [del](http://digitaltembo.github.io/estuary-rpc/functions/estuary_rpc.del.html), or [ws](http://digitaltembo.github.io/estuary-rpc/functions/estuary_rpc.ws.html)  methods defined in `estuary-rpc` to define the metadata about the given REST or WS endpoint definitions - most importantly the URL at which the endpoint will be accessed, but also any other metadata/auth requirements/upload definitions should go here. For Example:
```ts
export const exampleApiMeta = {
  foo: {
    emptyPost: post<number, number, ExampleMeta>("foo/emptyPost"),
    simpleGet: get<string, string, ExampleMeta>("foo/simpleGet", { needsAuth: true }),
    simpleStream: ws<Foo, Bar, ExampleMeta>("foo/simpleStream"),
  },
  fileUpload: post<void, null, ExampleMeta>("fileUpload", { uploads: ["someFile.txt"] }),
};
```
* Your API type, inferred from your API metadata definition like so:
```ts
export type ExampleApi<Closure> = ApiTypeof<Closure, ExamlpeMeta, typeof exampleApiMeta>;
// You may also want to define the service types individually, for implementing them one at a time:
export type FooService<Closure> = ExampleApi<Closure>["foo"];
```

---
_Source: https://npm.io/package/estuary-rpc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
