Skip to main content
Version: dev

Fory gRPC

Fory gRPC combines normal gRPC transport semantics with request and response models generated by the Fory compiler. The payload marshaller uses Fory rather than protobuf message bytes.

When to Use It

Use Fory gRPC when every peer is generated from the same Fory IDL, protobuf IDL, or FlatBuffers IDL contract and supports the matching Fory runtime. Use ordinary protobuf gRPC when generic protobuf clients, reflection tools, or protobuf message bytes are required.

Schema Frontends

Fory gRPC companions can be generated from:

The compiler's Generated Code reference describes the model and service artifacts. Use Build Integration to wire generation into a project build.

Workflow

  1. Define messages and services in a supported compiler frontend.
  2. Generate models and gRPC companions with foryc.
  3. Add the normal gRPC dependencies for the selected runtime.
  4. Implement the generated server base and call the generated client.
  5. Verify unary and streaming calls between generated peers.

Python generates asynchronous grpc.aio companions by default and supports sync generation with --grpc-python-mode=sync. JavaScript uses @grpc/grpc-js for Node.js; browser clients are generated separately with --grpc-web and use grpc-web.

Runtime Guides

RuntimeGuide
JavaJava
PythonPython
C++C++
GoGo
RustRust
JavaScript/TypeScriptNode.js and gRPC-Web
C#C#
DartDart
ScalaScala
KotlinKotlin

See Architecture for payload and transport ownership and Interoperability for peer compatibility.