pyRPC
Get Started

Comparison

How pyRPC compares to other RPC frameworks.

pyRPC brings tRPC-level type safety to Python + TypeScript stacks. It syncs your Python procedure signatures into TypeScript contracts automatically -- no OpenAPI schemas, no codegen pipelines, no manual boilerplate.

At a Glance

FeaturepyRPCtRPCgRPCFastAPI + OpenAPI
Backend languagePythonTypeScriptMulti-languagePython
Frontend typesAuto-generated TypeScriptBuilt-in TypeScriptGenerated stubsManual or generated
Schema / IDL requiredNone (Python types)None (TypeScript types).proto filesOpenAPI spec
Framework-agnosticYes (ASGI)Node.js onlyYes (polyglot)FastAPI only
TransportHTTP/JSONHTTP/JSONHTTP/2 (binary)HTTP/JSON
Works in monorepoYes (workspace mode)YesYesManual
Cross-repo typesYes (server mode)No (same repo)Yes (shared proto)Only via OpenAPI
Setup timeOne commandOne commandProto compilationScaffold + generator

Key Differences

vs tRPC

  • pyRPC: Python backend, TypeScript frontend, shared types. Works across language boundaries.
  • tRPC: TypeScript-only. Requires your backend to be Node.js.

vs gRPC

  • pyRPC: Zero-config. No .proto files or IDLs. Uses standard Python functions as the source of truth over HTTP/JSON.
  • gRPC: Requires strict IDLs (Protocol Buffers) and binary serialization. More performant for inter-service communication, but carries much higher DX overhead for web-to-server apps.

vs FastAPI

  • pyRPC: Built for procedure-calls. Python backend types are automatically available in your TypeScript frontend with zero manual mapping.
  • FastAPI: Built for REST. OpenAPI schema is generated, but you still need separate client code, generators, or manual type definitions on the frontend.

When to Use pyRPC

✅ You want tRPC-like type safety but your backend runs Python, not Node.js.
✅ You're shipping a React / Next.js frontend with a Python backend and want shared types.
✅ You need a drop-in solution for an existing FastAPI or Flask app.
✅ You prefer standard Python type hints over OpenAPI schemas or gRPC protos.

When NOT to Use pyRPC

❌ Your backend is Node.js -- tRPC is the native choice and will always be ahead.
❌ You need strict schema governance with a single IDL source of truth -- gRPC's proto-first workflow may suit you better.
❌ You are building a public REST API for third-party consumption -- OpenAPI remains the universal standard for that use case.
❌ Your frontend is not TypeScript -- pyRPC's type safety is built for the TS ecosystem.

# pyRPC: Your function is the API
from pyrpc_core import rpc

@rpc
async def get_user(user_id: int) -> User:
    return await db.get_user(user_id)