# everythingfornothing/trpc-cpp architecture

> Architecture diagram of the GitHub repository everythingfornothing/trpc-cpp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/everythingfornothing/trpc-cpp
- Repository: https://github.com/everythingfornothing/trpc-cpp
- Video tour (about a minute): https://gitdiagram.com/everythingfornothing/trpc-cpp/video

## Overview

tRPC-Cpp is an RPC framework for building network services and clients. A typical call starts in a client proxy, passes through transport and protocol encoding, reaches a server adapter, and is dispatched to a service; replies follow the transport path back. The repository also provides runtime scheduling, streaming, admin management, configuration, naming, observability, overload controls, and protocol/compression plugins. The README supports the major capabilities and layer responsibilities; source excerpts provide only selected implementation links, so uncertain wiring is omitted or marked dashed.

Main entry points: [`trpc/server/service_adapter.cc`](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/server/service_adapter.cc) (Service Adapter), [`trpc/client/service_proxy.cc`](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/client/service_proxy.cc) (Client Proxies), [`trpc/codec/protocol.h`](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/codec/protocol.h) (Protocol Model), [`trpc/common/runtime_manager.cc`](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/common/runtime_manager.cc) (Runtime Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rpc["RPC Services"]
  node_client["Client Proxies<br/>[service_proxy.cc]"]
  node_client_context["Client Context<br/>[client_context.h]"]
  node_server["Service Adapter<br/>[service_adapter.cc]"]
  node_server_context["Server Context<br/>[server_context.h]"]
  node_streams["Streaming RPC"]
end

subgraph group_transport["Transport Protocols"]
  node_protocol["Protocol Model<br/>[protocol.h]"]
  node_codec_registry["Codec Registry<br/>[codec_manager.cc]"]
  node_grpc_http["gRPC and HTTP<br/>[grpc_protocol.cc]"]
  node_redis["Redis Client"]
end

subgraph group_runtime["Runtime Execution"]
  node_runtime_manager["Runtime Manager<br/>[runtime_manager.cc]"]
  node_fiber["Fiber Runtime<br/>[fiber_runtime.h]"]
  node_reactor["Reactor I/O<br/>[reactor_impl.cc]"]
end

subgraph group_plugins["Plugins and Controls"]
  node_config["Framework Config<br/>[trpc_config.h]"]
  node_naming["Service Naming"]
  node_compression["Compression"]
  node_filters["Request Filters"]
  node_overload["Overload Control"]
end

subgraph group_operations["Operations and Observability"]
  node_admin["Admin Interface<br/>[admin_service.cc]"]
  node_metrics["Metrics<br/>[trpc_metrics.cc]"]
  node_rpcz["RPC Tracing<br/>[trpc_rpcz.cc]"]
end

node_caller(("Application Caller"))
node_remote_service(("Remote Service"))

node_caller -->|"invokes"| node_client
node_client -.->|"uses context"| node_client_context
node_client -.->|"encodes calls"| node_protocol
node_protocol -->|"transmits messages"| node_remote_service
node_remote_service -.->|"delivers requests"| node_server
node_server -.->|"dispatches requests"| node_server_context
node_server -.->|"decodes messages"| node_protocol
node_client -->|"supports streaming"| node_streams
node_server -->|"supports streaming"| node_streams
node_runtime_manager -->|"initializes runtime"| node_fiber
node_runtime_manager -->|"reads settings"| node_config
node_runtime_manager -->|"initializes plugin"| node_metrics
node_server -.->|"runs filters"| node_filters
node_server -.->|"applies controls"| node_overload
node_client -.->|"selects endpoints"| node_naming
node_codec_registry -->|"registers codecs"| node_grpc_http
node_client -->|"offers component"| node_redis
node_protocol -->|"supports compression"| node_compression
node_admin -->|"manages service"| node_remote_service
node_server -->|"supports tracing"| node_rpcz
node_server -.->|"reports metrics"| node_metrics
node_reactor -->|"handles network I/O"| node_remote_service

click node_client "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/client/service_proxy.cc"
click node_client_context "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/client/client_context.h"
click node_server "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/server/service_adapter.cc"
click node_server_context "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/server/server_context.h"
click node_streams "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/stream/stream_handler_manager.cc"
click node_protocol "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/codec/protocol.h"
click node_codec_registry "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/codec/codec_manager.cc"
click node_grpc_http "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/codec/grpc/grpc_protocol.cc"
click node_redis "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/client/redis/redis_service_proxy.cc"
click node_runtime_manager "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/common/runtime_manager.cc"
click node_fiber "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/runtime/fiber_runtime.h"
click node_reactor "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/runtime/iomodel/reactor/default/reactor_impl.cc"
click node_config "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/common/config/trpc_config.h"
click node_naming "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/naming/selector_workflow.cc"
click node_compression "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/compressor/compressor_factory.cc"
click node_filters "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/filter/server_filter_controller.cc"
click node_overload "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/overload_control/high_percentile/high_percentile_overload_controller.cc"
click node_admin "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/admin/admin_service.cc"
click node_metrics "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/metrics/trpc_metrics.cc"
click node_rpcz "https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/rpcz/trpc_rpcz.cc"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_client_context,node_server,node_server_context,node_streams toneBlue
class node_protocol,node_codec_registry,node_grpc_http,node_redis toneAmber
class node_runtime_manager,node_fiber,node_reactor toneMint
class node_config,node_naming,node_compression,node_filters,node_overload toneRose
class node_admin,node_metrics,node_rpcz,node_caller,node_remote_service toneIndigo
```

## Components

### RPC Services

- [Client Proxies](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/client/service_proxy.cc): `trpc/client/service_proxy.cc`
- [Client Context](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/client/client_context.h): `trpc/client/client_context.h`
- [Service Adapter](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/server/service_adapter.cc): `trpc/server/service_adapter.cc`
- [Server Context](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/server/server_context.h): `trpc/server/server_context.h`
- [Streaming RPC](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/stream/stream_handler_manager.cc): `trpc/stream/stream_handler_manager.cc`

### Transport Protocols

- [Protocol Model](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/codec/protocol.h): `trpc/codec/protocol.h`
- [Codec Registry](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/codec/codec_manager.cc): `trpc/codec/codec_manager.cc`
- [gRPC and HTTP](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/codec/grpc/grpc_protocol.cc): `trpc/codec/grpc/grpc_protocol.cc`
- [Redis Client](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/client/redis/redis_service_proxy.cc): `trpc/client/redis/redis_service_proxy.cc`

### Runtime Execution

- [Runtime Manager](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/common/runtime_manager.cc): `trpc/common/runtime_manager.cc`
- [Fiber Runtime](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/runtime/fiber_runtime.h): `trpc/runtime/fiber_runtime.h`
- [Reactor I/O](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/runtime/iomodel/reactor/default/reactor_impl.cc): `trpc/runtime/iomodel/reactor/default/reactor_impl.cc`

### Plugins and Controls

- [Framework Config](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/common/config/trpc_config.h): `trpc/common/config/trpc_config.h`
- [Service Naming](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/naming/selector_workflow.cc): `trpc/naming/selector_workflow.cc`
- [Compression](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/compressor/compressor_factory.cc): `trpc/compressor/compressor_factory.cc`
- [Request Filters](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/filter/server_filter_controller.cc): `trpc/filter/server_filter_controller.cc`
- [Overload Control](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/overload_control/high_percentile/high_percentile_overload_controller.cc): `trpc/overload_control/high_percentile/high_percentile_overload_controller.cc`

### Operations and Observability

- [Admin Interface](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/admin/admin_service.cc): `trpc/admin/admin_service.cc`
- [Metrics](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/metrics/trpc_metrics.cc): `trpc/metrics/trpc_metrics.cc`
- [RPC Tracing](https://github.com/everythingfornothing/trpc-cpp/blob/main/trpc/rpcz/trpc_rpcz.cc): `trpc/rpcz/trpc_rpcz.cc`

### Other components

- **Application Caller**
- **Remote Service**

## Connections

- Application Caller → Client Proxies: invokes (evidence: `README.md`)
- Client Proxies → Client Context: uses context
- Client Proxies → Protocol Model: encodes calls
- Protocol Model → Remote Service: transmits messages (evidence: `README.md`)
- Remote Service → Service Adapter: delivers requests
- Service Adapter → Server Context: dispatches requests (evidence: `trpc/server/service_adapter.cc`)
- Service Adapter → Protocol Model: decodes messages
- Client Proxies → Streaming RPC: supports streaming (evidence: `README.md`)
- Service Adapter → Streaming RPC: supports streaming (evidence: `README.md`)
- Runtime Manager → Fiber Runtime: initializes runtime (evidence: `trpc/common/runtime_manager.cc`)
- Runtime Manager → Framework Config: reads settings (evidence: `trpc/common/runtime_manager.cc`)
- Runtime Manager → Metrics: initializes plugin (evidence: `trpc/common/runtime_manager.cc`)
- Service Adapter → Request Filters: runs filters
- Service Adapter → Overload Control: applies controls
- Client Proxies → Service Naming: selects endpoints
- Codec Registry → gRPC and HTTP: registers codecs (evidence: `trpc/codec/codec_manager.cc`)
- Client Proxies → Redis Client: offers component (evidence: `README.md`)
- Protocol Model → Compression: supports compression (evidence: `README.md`)
- Admin Interface → Remote Service: manages service (evidence: `README.md`)
- Service Adapter → RPC Tracing: supports tracing (evidence: `README.md`)
- Service Adapter → Metrics: reports metrics
- Reactor I/O → Remote Service: handles network I/O (evidence: `README.md`)
