Get Started

Quickstart

Get a working pRPC server and client in under 2 minutes.

Quickstart

Copy, paste, run. No fluff — just a working pRPC server and client call.

1. Install

uv add prpc prpc-fastapi uvicorn

2. Server

Create server.py:

from fastapi import FastAPI
from prpc import rpc
from prpc_fastapi import mount_fastapi

app = FastAPI()

@rpc
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

@rpc
def greet(name: str = "World") -> str:
    """Greet someone."""
    return f"Hello, {name}!"

mount_fastapi(app)

Run it:

uvicorn server:app --reload

Expected output:

INFO:     Uvicorn running on http://127.0.0.1:8000
INFO:     Application startup complete.

3. Client

Create client.py (in another terminal):

from prpc import RPCClient

with RPCClient("http://localhost:8000") as client:
    result = client.add(a=10, b=5)
    print(result)  # 15

    msg = client.greet(name="pRPC")
    print(msg)  # Hello, pRPC!

Run it:

python client.py

Expected output:

15
Hello, pRPC!

Done

You now have a working pRPC server + client. Next:

  • Installation — Adapters (Flask, codegen)
  • Concepts — Mental model, protocol, error handling
  • Server — Routers, procedures, context