# a-sevastyanov/protobridge architecture

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

- Interactive diagram: https://gitdiagram.com/a-sevastyanov/protobridge
- Repository: https://github.com/a-sevastyanov/protobridge

## Overview

protobridge is a small Python-to-C++ process communication demo. The intended workflow is to construct UserInfo, serialize it with Protobuf, prefix the payload length, send it over TCP, then receive and parse it. The current sender implements sending, while the receiver source only establishes a connection and closes it; README describes exact-length receive and parsing as unfinished. The receiver header declares recv_exact, but its implementation is not present in the supplied tree.

Main entry points: [`sender/sender.py`](https://github.com/a-sevastyanov/protobridge/blob/master/sender/sender.py) (Sender), [`receiver/receiver.cpp`](https://github.com/a-sevastyanov/protobridge/blob/master/receiver/receiver.cpp) (Receiver server), [`receiver/receiver.hpp`](https://github.com/a-sevastyanov/protobridge/blob/master/receiver/receiver.hpp) (Exact receive declaration), [`proto/user.proto`](https://github.com/a-sevastyanov/protobridge/blob/master/proto/user.proto) (UserInfo schema)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sender["Python sender"]
  node_sender["Sender<br/>[sender.py]"]
end

subgraph group_protocol["Wire protocol"]
  node_schema["UserInfo schema<br/>[user.proto]"]
  node_tcp["TCP socket"]
end

subgraph group_receiver["C++ receiver"]
  node_receiver["Receiver server<br/>[receiver.cpp]"]
  node_recvdecl["Exact receive declaration<br/>[receiver.hpp]"]
end

node_user(("User process"))

node_user -->|"starts"| node_sender
node_sender -->|"serializes as"| node_schema
node_sender -->|"sends framed data"| node_tcp
node_receiver -->|"listens and accepts"| node_tcp
node_recvdecl -.->|"declares receive helper"| node_receiver

click node_sender "https://github.com/a-sevastyanov/protobridge/blob/master/sender/sender.py"
click node_schema "https://github.com/a-sevastyanov/protobridge/blob/master/proto/user.proto"
click node_receiver "https://github.com/a-sevastyanov/protobridge/blob/master/receiver/receiver.cpp"
click node_recvdecl "https://github.com/a-sevastyanov/protobridge/blob/master/receiver/receiver.hpp"

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_sender,node_user toneBlue
class node_schema,node_tcp toneAmber
class node_receiver,node_recvdecl toneMint
```

## Components

### Python sender

- [Sender](https://github.com/a-sevastyanov/protobridge/blob/master/sender/sender.py): `sender/sender.py`

### Wire protocol

- [UserInfo schema](https://github.com/a-sevastyanov/protobridge/blob/master/proto/user.proto): `proto/user.proto`
- **TCP socket**

### C++ receiver

- [Receiver server](https://github.com/a-sevastyanov/protobridge/blob/master/receiver/receiver.cpp): `receiver/receiver.cpp`
- [Exact receive declaration](https://github.com/a-sevastyanov/protobridge/blob/master/receiver/receiver.hpp): `receiver/receiver.hpp`

### Other components

- **User process**

## Connections

- User process → Sender: starts
- Sender → UserInfo schema: serializes as
- Sender → TCP socket: sends framed data
- Receiver server → TCP socket: listens and accepts
- Exact receive declaration → Receiver server: declares receive helper
