What the fuss is about RPC
Tags: javascript, webdev, solidjs, beginners
Published: 2023-03-21 20:45:35

![https://dev.to/karankumarshreds/go-rpc-implementation-4731](https://cdn-images-1.medium.com/max/2000/0*sPbfswnEX382xvcG.png)_https://dev.to/karankumarshreds/go-rpc-implementation-4731_

RPC ( **R** emote **P** rocedure **C** all) — is a protocol to call servers and invoke some defined code on them. In comparison to **REST** or **GraphQL** RPC requests don’t need to return anything. **RPC is oriented toward invoking arbitrary logic on the server.** Instead of sending and receiving resources like in REST. On top of that, you can use it for this also.

## What are the benefits of RPC?

- Granularity

- Independent

- Batching

Let’s stop here and expand on these concepts:

**Granularity** — You can use these commands separately even if they share a common code or do almost the same. In REST we write logic around resources. It needs to be unified for all use cases but not all are the same.

**Independent** — command acts on their own.

**Batching** — Helps with sending commands in one network request. This can help avoid the waterfall requests problem.

## Why is RPC brought now?

Some time ago [Ryan Carniato introduced Solid Start on Vite Conf](https://www.youtube.com/watch?v=G5vwaoXck_g). He introduced [`server$`](https://start.solidjs.com/api/server) function. Using it you can turn any function async function into an RPC function that is executed on the server. This is huge!

Imagine building a client component. Next to it function that will be executed on the server. Then call that function inside of this client-side component and get results.

RPC also was introduced in [Qwik](https://qwik.builder.io/). It can do the same as what is done in Solid but it goes even further. It enables us to make RPC from the closures function and derive closure variables.

![https://twitter.com/mhevery/status/1630413469139996672](https://cdn-images-1.medium.com/max/2400/0*ZI17UGTf2h2PsSM3)_https://twitter.com/mhevery/status/1630413469139996672_

These solutions are great but they are coupled with their frameworks.

### [Bling](https://github.com/TanStack/bling/) enters the chat

As we can read in the repo. [Bling](https://github.com/TanStack/bling/) is a “framework agnostic transpilation utilities for client/server RPCs, env isolation, islands, module splitting, and more.” **It brings function colocation to every framework and open-up possibilities for island architecture.**

## What is Island Architecture?

Imagine your website as an ocean. You are sailing through it and only a certain part of it is interactive. Like comments section or like/dislike button. The interactive parts of a website are called islands.

![Photo by Denys Nevozhai on Unsplash](https://cdn-images-1.medium.com/max/5984/0*uYw5RcD_PLUXfQUz)_Photo by Denys Nevozhai on https://unsplash.com_

## Credits

I want to give credit to the people that were involved in creating or shaping it.

About RPC I read in [Solid Start docs](https://start.solidjs.com/api/server) and stumbled upon Qwik's showcase from Steve, something [like this one](https://twitter.com/Steve8708/status/1629206231364808705). Then I learn that [Ryan Carniato](https://www.youtube.com/watch?v=G5vwaoXck_g) introduced a solid start on vite conf. The latest library [Bling](https://github.com/TanStack/bling/) is inspired by all the previous works of Solid and Qwik.

I first heard about islands' architecture when [Astro](https://astro.build/) came out. They wrote about that in [their docs](https://docs.astro.build/en/concepts/islands/). They mention [Katie Sylor-Miller](https://twitter.com/ksylor) and [Jason Miller's post](https://jasonformat.com/islands-architecture/).

## Further reading

I strongly recommend reading [Solid Start’s docs](https://start.solidjs.com/getting-started/what-is-solidstart) and [Qwik docs](https://qwik.builder.io/docs/overview/). There are a lot of ideas and fresh looks at building apps. Not only connected with RPC or Islands Architecture. Also, take a look at Tanner Linsley [Bling](https://github.com/TanStack/bling/) and join his [discord server](https://tlinz.com/discord) to be up to date.