gRPC Elixir implements the gRPC protocol with unary and streaming RPCs, interceptors, TLS, and HTTP transcoding. Servers and clients use a unified stream-based API.
Overview
gRPC Elixir is an Elixir implementation of the gRPC protocol for building RPC clients and servers. It supports unary calls, server-side streaming, bidirectional streaming, interceptors, compression, metadata, TLS, and HTTP transcoding for browser or REST-style access.
Servers define services with a stream-based API where even unary requests flow through stream operators such as map, effect, run, and maperror for transformation, side effects, and structured error handling. Applications supervise GRPC.Server.Endpoint modules and register generated services from protobuf definitions.
Clients connect with URI-like targets resolved through an internal resolver, including DNS, IPv4, Unix domain sockets, and xDS endpoints. Adapters include Gun by default and optional Mint for pure Elixir HTTP/2, with automatic reconnection and keepalive options on Mint. Interceptors extend logging, tracing, and authentication on both sides.
Protobuf code is generated with protoc and Elixir plugins or helper packages. Optional HTTP transcoding and a CORS interceptor support browser clients. The Hex package splits client (:grpc) and server (:grpc_server) dependencies in current releases.
Key features
- Unary and streaming RPCs
- Unified stream-based server API
- Client and server interceptors
- DNS, Unix, and xDS targets
- Gun and Mint client adapters
- HTTP transcoding support
- CORS interceptor for browsers
- TLS and message compression
Use cases
- Elixir microservices over gRPC
- Bidirectional streaming services
- gRPC with HTTP transcoding
- Browser-facing gRPC via CORS
- Fault-tolerant stream pipelines