Language Bindings
ZAP SDK documentation for all supported languages
ZAP provides native bindings for 11 programming languages. Each binding is built on the reference Cap'n Proto implementation for that language.
Supported Languages
RustReference implementation with full async supportGoIdiomatic Go with goroutine-safe clientsPythonAsync/await API with pycapnpJavaScriptNode.js and browser supportC++High-performance native bindingCMinimal C API for embeddedJavaJVM binding with Netty transportC#.NET binding with async supportErlangOTP-compatible bindingOCamlFunctional binding with LwtHaskellPure functional binding
Implementation Status
| Language | Client | Server | Gateway | PQ-TLS | Consensus |
|---|---|---|---|---|---|
| Rust | Yes | Yes | Yes | Yes | Yes |
| Go | Yes | Yes | Yes | Yes | Yes |
| Python | Yes | Yes | Yes | Partial | Planned |
| JavaScript | Yes | Partial | Yes | No | Planned |
| C++ | Yes | Yes | Yes | Yes | Partial |
| C | Yes | Partial | No | No | No |
| Java | Yes | Yes | Partial | Partial | Planned |
| C# | Yes | Partial | No | No | No |
| Erlang | Yes | Yes | Partial | No | Planned |
| OCaml | Yes | Partial | No | No | No |
| Haskell | Yes | Partial | No | No | No |
Common Patterns
Client Creation
All bindings follow a similar pattern:
// Rust
let client = Zap::connect("zap://localhost:9000").await?;// Go
client, err := zap.Connect(ctx, "zap://localhost:9000")# Python
client = await Zap.connect("zap://localhost:9000")// JavaScript
const client = await Zap.connect('zap://localhost:9000');Error Handling
Each binding uses idiomatic error handling:
- Rust:
Result<T, Error>with?operator - Go: Multiple return values
(result, error) - Python: Exceptions with async context
- JavaScript: Promises with try/catch or
.catch()
Async/Await
Most bindings support async operations:
// Rust (tokio)
let tools = client.list_tools().await?;// Go (goroutines)
tools, err := client.ListTools(ctx)# Python (asyncio)
tools = await client.list_tools()// JavaScript (Promises)
const tools = await client.listTools();Schema Code Generation
Generate bindings from the ZAP schema:
# Clone the schema
git clone https://github.com/zap-proto/zap
cd zap/schema
# Generate for your language
capnp compile -o rust zap.capnp
capnp compile -o go zap.capnp
capnp compile -o c++ zap.capnpSee language-specific pages for detailed code generation instructions.
Contributing
Language bindings are maintained in separate repositories:
- zap-proto/rust - Rust
- zap-proto/go - Go
- zap-proto/py - Python
- zap-proto/js - JavaScript
Contributions welcome! See each repo's CONTRIBUTING.md for guidelines.
Rust
ZAP Rust SDK - Reference implementation
GoZAP Go SDK - Idiomatic Go binding
PythonZAP Python SDK - Async/await API
JavaScriptZAP JavaScript SDK - Node.js and browser support
C++ZAP C++ SDK - High-performance native binding
CZAP C SDK - Minimal C API for embedded systems
JavaZAP Java SDK - JVM binding with Netty transport
C#ZAP C# SDK - .NET binding with async support
ErlangZAP Erlang SDK - OTP-compatible binding
OCamlZAP OCaml SDK - Functional binding with Lwt
HaskellZAP Haskell SDK - Pure functional binding
Was this page useful?