Introduction
Welcome to pyRPC - The type-safe, Python-first RPC framework.
pyRPC is a modern "drop-in RPC layer" for Python. It turns your backend into a library of typed async functions that can be called from anywhere.
Inspired by the DX of tRPC and Better Auth, pyRPC eliminates the need for OpenAPI schemas, heavy generators, or manual boilerplate.
The Problem
Modern web development often feels like managing two separate worlds. You have a typed Python backend and a typed TypeScript frontend, but the bridge between them is usually a "dumb" JSON-RPC or REST interface.
You end up manually writing TypeScript interfaces for Python models, handling string-based API routes that break when you rename a function, and relying on OpenAPI specs that are often out of sync with reality.
The Solution
pyRPC treats your backend as a shared library. It synchronizes your Python procedure signatures directly into TypeScript contracts.
- No OpenAPI: No intermediate spec files to maintain or sync.
- No SDKs: No heavy generated code—just clean TypeScript contracts.
- Pure Types: Your procedures, fully typed, from end-to-end.
Key Features
- Python-native: Built for asyncio, Pydantic v2, and modern type hints.
- End-to-End Typing: Request, response, and errors stay in sync automatically.
- Zero Config: Drop it into your existing FastAPI or Flask app in seconds.
- Modular: Only install what you need (core, adapters, codegen).
How it works
- Define: Use the
@rpcdecorator on any Python function. - Mount: Attach your pyRPC registry to your favorite web framework.
- Call: Use the pyRPC client (Python or via generated TypeScript contracts) to call your functions.