Plugins
Code Generation
Generate TypeScript and Python client SDKs from your pRPC router
prpc-codegen
Automatically generate type-safe client SDKs for TypeScript and Python from your pRPC server definition.
Installation
pip install prpc-codegenCLI Usage
Generate a TypeScript client:
prpc-codegen --input myapp/router.py --output ./generated/client.ts --lang typescriptGenerate a Python client:
prpc-codegen --input myapp/router.py --output ./generated/client.py --lang pythonFeatures
✅ TypeScript SDK generation
✅ Python SDK generation
✅ Full type inference
✅ Tree-shakeable modular output
✅ Documentation comments
Generated Client Example
TypeScript
// generated/client.ts
import { createClient } from '@prpc/client';
const client = createClient({ baseUrl: 'http://localhost:8000' });
// Fully typed!
const user = await client.getUser({ userId: 1 });
console.log(user.name); // TypeScript knows this is a stringPython
# generated/client.py
from prpc import Client
client = Client("http://localhost:8000")
# Type hints included
user = await client.get_user(user_id=1)
print(user.name) # IDE autocomplete works!Configuration
Create a prpc.config.json:
{
"input": "myapp/router.py",
"outputs": [
{
"path": "./clients/typescript/index.ts",
"lang": "typescript"
},
{
"path": "./clients/python/client.py",
"lang": "python"
}
],
"includeDocstrings": true
}Run with:
prpc-codegen --config prpc.config.jsonCI/CD Integration
Add to your GitHub Actions workflow:
- name: Generate pRPC Clients
run: |
pip install prpc-codegen
prpc-codegen --config prpc.config.jsonNext Steps
- Learn about Client Usage
- Explore TypeScript Integration