What is gRPC?
gRPC is a high-performance RPC framework that uses Protocol Buffers
gRPC is a modern, open-source, high-performance Remote Procedure Call (RPC) framework that can run in any environment. It uses Protocol Buffers (protobuf) as the interface definition language and supports multiple programming languages.
Fern is compatible with gRPC services and can generate SDKs and documentation from your .proto
files.
Need help getting started with gRPC and Fern? Get live support here
Below is an example of a gRPC service definition:
user_service.proto
gRPC Features
gRPC offers several key features that make it ideal for modern applications:
High Performance
- Binary protocol with Protocol Buffers
- HTTP/2 transport for multiplexing and flow control
- Efficient serialization and deserialization
Multiple Communication Patterns
- Unary RPCs: Simple request/response
- Server Streaming: Server sends stream of responses
- Client Streaming: Client sends stream of requests
- Bidirectional Streaming: Both sides send streams
Cross-Platform Support
- Native support for 10+ programming languages
- Generated client libraries and server stubs
- Consistent API across all platforms
Setup your fern folder
Start by initializing your fern folder with a gRPC service
This will initialize a directory like the following
gRPC vs REST
Common Use Cases
gRPC is particularly well-suited for:
- Microservices Communication: High-performance inter-service communication
- Real-time Applications: Streaming for live updates and real-time features
- Mobile Applications: Efficient mobile-to-server communication
- IoT Systems: Lightweight communication for resource-constrained devices
- APIs with Strong Contracts: Type-safe communication with schema evolution