DEV Community

Daniel Nagy
Daniel Nagy

Posted on

Introducing Transporter

I am the author of Transporter. Transporter was made public on Jan 2, 2024. The purpose of this post it to bring attention to Transporter and receive feedback. I hope this is an appropriate place to self-promote my work.

Transporter is a library for typesafe distributed computing in TypeScript. Transporter was influenced by Comlink and rxjs.

Transporter makes it possible to call functions in other processes as if they were in-process. This is known as remote procedure call or RPC for short. Unlike other TypeScript RPC libraries, that focus primarily on RPC over HTTP between a web server and client, Transporter is a little more low level and general purpose.

I began work on Transporter back in 2021 as part of a larger prototype that involved reusing UI fragments in React Native and in the browser. I wanted there to be a well defined API barrier between the sub-frames and the host.

Some key differences between Transporter and other TypeScript RPC libraries are

  1. Transporter is designed to be general purpose. Not only can you use Transporter over HTTP but you can use transporter over just about any transport layer, including postMessage in the browser.

  2. Transporter does not use a router. Instead you organize your API into namespaces using object composition.

  3. Transporter does not use a builder API or otherwise couple your functions to Transporter. You can organize your API however you want using the syntax of TypeScript. This allows Transporter to support generic functions.

  4. Transporter supports recursive RPC depending on your subprotocol. Recursive RPC allows state to be held on the call stack between processes. This also enables the use of Observables for pub-sub.

If I have peeked your interest in Transporter than please read my blog post and checkout Transporter's GitHub page where you can find examples and API docs! If you would like to discuss Transporter then feel free to start a discussion on GitHub. Thanks!

Top comments (0)