# fangfengxiang/kong-plugin-yar-grpc architecture

> Architecture diagram of the GitHub repository fangfengxiang/kong-plugin-yar-grpc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fangfengxiang/kong-plugin-yar-grpc
- Repository: https://github.com/fangfengxiang/kong-plugin-yar-grpc

## Overview

This Kong plugin exposes two access-phase protocol-bridge directions: gRPC requests can reach PHP Yar services, and PHP Yar requests can reach gRPC services. The README documents the plugin’s handler and schema, plus the bridge package’s endpoint, orchestration, and transport layers; those bridge internals are external dependencies, not files in this repository. Relationships below are documented in the README; no source excerpts were available.

Main entry points: [`kong/plugins/yar_grpc_bridge/handler.lua`](https://github.com/fangfengxiang/kong-plugin-yar-grpc/blob/main/kong/plugins/yar_grpc_bridge/handler.lua) (Access handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kong["Kong plugin"]
  node_handler["Access handler<br/>[handler.lua]"]
  node_schema["Config schema<br/>[schema.lua]"]
end

subgraph group_bridge["Bridge runtime"]
  node_grpc2yar_endpoint["gRPC-to-Yar entry"]
  node_grpc2yar_orchestration["gRPC-to-Yar orchestration"]
  node_yar_client_lib["Lua Yar client"]
  node_yar2grpc_endpoint["Yar-to-gRPC entry"]
  node_yar2grpc_dispatch["Yar-to-gRPC dispatch"]
  node_grpc_transport["gRPC transport"]
end

subgraph group_backends["Backend services"]
  node_php_yar_server["PHP Yar server"]
  node_go_grpc_server["Go gRPC server"]
end

node_grpc_client(("gRPC client"))
node_yar_client(("PHP Yar client"))

node_grpc_client -->|"sends HTTP/2"| node_handler
node_handler -->|"dispatches grpc2yar"| node_grpc2yar_endpoint
node_grpc2yar_endpoint -->|"calls"| node_grpc2yar_orchestration
node_grpc2yar_orchestration -->|"uses"| node_yar_client_lib
node_yar_client_lib -->|"calls"| node_php_yar_server
node_yar_client -->|"sends HTTP/1.1"| node_handler
node_handler -->|"dispatches yar2grpc"| node_yar2grpc_endpoint
node_yar2grpc_endpoint -->|"calls"| node_yar2grpc_dispatch
node_yar2grpc_dispatch -->|"uses"| node_grpc_transport
node_grpc_transport -->|"calls"| node_go_grpc_server

click node_handler "https://github.com/fangfengxiang/kong-plugin-yar-grpc/blob/main/kong/plugins/yar_grpc_bridge/handler.lua"
click node_schema "https://github.com/fangfengxiang/kong-plugin-yar-grpc/blob/main/kong/plugins/yar_grpc_bridge/schema.lua"

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_handler,node_schema,node_grpc_client,node_yar_client toneBlue
class node_grpc2yar_endpoint,node_grpc2yar_orchestration,node_yar_client_lib,node_yar2grpc_endpoint,node_yar2grpc_dispatch,node_grpc_transport toneAmber
class node_php_yar_server,node_go_grpc_server toneMint
```

## Components

### Kong plugin

- [Access handler](https://github.com/fangfengxiang/kong-plugin-yar-grpc/blob/main/kong/plugins/yar_grpc_bridge/handler.lua): `kong/plugins/yar_grpc_bridge/handler.lua`
- [Config schema](https://github.com/fangfengxiang/kong-plugin-yar-grpc/blob/main/kong/plugins/yar_grpc_bridge/schema.lua): `kong/plugins/yar_grpc_bridge/schema.lua`

### Bridge runtime

- **gRPC-to-Yar entry**
- **gRPC-to-Yar orchestration**
- **Lua Yar client**
- **Yar-to-gRPC entry**
- **Yar-to-gRPC dispatch**
- **gRPC transport**

### Backend services

- **PHP Yar server**
- **Go gRPC server**

### Other components

- **gRPC client**
- **PHP Yar client**

## Connections

- gRPC client → Access handler: sends HTTP/2 (evidence: `README.md`)
- Access handler → gRPC-to-Yar entry: dispatches grpc2yar (evidence: `README.md`)
- gRPC-to-Yar entry → gRPC-to-Yar orchestration: calls (evidence: `README.md`)
- gRPC-to-Yar orchestration → Lua Yar client: uses (evidence: `README.md`)
- Lua Yar client → PHP Yar server: calls (evidence: `README.md`)
- PHP Yar client → Access handler: sends HTTP/1.1 (evidence: `README.md`)
- Access handler → Yar-to-gRPC entry: dispatches yar2grpc (evidence: `README.md`)
- Yar-to-gRPC entry → Yar-to-gRPC dispatch: calls (evidence: `README.md`)
- Yar-to-gRPC dispatch → gRPC transport: uses (evidence: `README.md`)
- gRPC transport → Go gRPC server: calls (evidence: `README.md`)
