Language Bindings
ZAP SDK documentation for all supported languages
Language Bindings
ZAP provides native bindings for 11 programming languages. Each binding is built on the reference Cap'n Proto implementation for that language.
Supported Languages
Rust
Reference implementation with full async support
Go
Idiomatic Go with goroutine-safe clients
Python
Async/await API with pycapnp
JavaScript
Node.js and browser support
C++
High-performance native binding
C
Minimal C API for embedded
Java
JVM binding with Netty transport
C#
.NET binding with async support
Erlang
OTP-compatible binding
OCaml
Functional binding with Lwt
Haskell
Pure 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-protocol/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-protocol/zap-rs - Rust
- zap-protocol/zap-go - Go
- zap-protocol/zap-py - Python
- zap-protocol/zap-js - JavaScript
Contributions welcome! See each repo's CONTRIBUTING.md for guidelines.
Rust
Go
Python
JavaScript
C++
C
Java
C#
Erlang
OCaml
Haskell
Last updated on