# edgarreis/opcua-asyncio architecture

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

- Interactive diagram: https://gitdiagram.com/edgarreis/opcua-asyncio
- Repository: https://github.com/edgarreis/opcua-asyncio

## Overview

asyncua is an asyncio-based Python OPC UA client/server library, with a synchronous wrapper. The main client workflow connects to an OPC UA server, establishes a session, and lets application code browse or read/write nodes and create subscriptions; the server workflow exposes an address space to clients. The graph also preserves documented history, events, methods, security, XML/address-space and high-availability capabilities. Source excerpts are partial, so uncertain internal links are omitted rather than inferred.

Main entry points: [`asyncua/client/client.py`](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/client/client.py) (Client API), [`asyncua/server/server.py`](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/server.py) (Server API), [`asyncua/client/ua_client.py`](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/client/ua_client.py) (Binary client), [`asyncua/server/binary_server_asyncio.py`](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/binary_server_asyncio.py) (Server transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client access"]
  node_client_api["Client API<br/>[client.py]"]
  node_wire_client["Binary client<br/>[ua_client.py]"]
  node_ha["High availability<br/>[ha_client.py]"]
  node_sync["Sync wrapper<br/>[sync.py]"]
end

subgraph group_server["Server runtime"]
  node_server_api["Server API<br/>[server.py]"]
  node_address_space[("Address space<br/>[address_space.py]")]
  node_server_transport["Server transport"]
  node_history["History services<br/>[history.py]"]
end

subgraph group_common["Shared domain API"]
  node_node_api["Node access<br/>[node.py]"]
  node_subscriptions["Subscriptions<br/>[subscription.py]"]
  node_node_management["Node management<br/>[manage_nodes.py]"]
  node_events["Events<br/>[events.py]"]
  node_xml_exchange["XML exchange<br/>[xmlimporter.py]"]
  node_xml_export["XML export<br/>[xmlexporter.py]"]
end

subgraph group_protocol["UA protocol"]
  node_ua_types["UA types<br/>[uatypes.py]"]
  node_ua_messages["UA messages<br/>[uaprotocol_auto.py]"]
end

subgraph group_security["Security"]
  node_crypto["Cryptography<br/>[uacrypto.py]"]
  node_security_policy["Security policies"]
end

node_app(("Application"))
node_opcpeer(("OPC UA peer"))

node_app -->|"uses"| node_client_api
node_client_api -->|"sends requests"| node_wire_client
node_client_api -->|"exposes nodes"| node_node_api
node_app -->|"reads and browses"| node_node_api
node_app -->|"subscribes"| node_subscriptions
node_client_api -->|"creates subscriptions"| node_subscriptions
node_wire_client -->|"exchanges binary"| node_opcpeer
node_opcpeer -->|"connects"| node_server_transport
node_app -->|"configures server"| node_server_api
node_server_api -.->|"manages address space"| node_address_space
node_server_api -->|"starts server"| node_server_transport
node_app -->|"adds or removes nodes"| node_node_management
node_app -->|"uses event services"| node_events
node_app -->|"reads history"| node_history
node_app -.->|"imports address space"| node_xml_exchange
node_app -.->|"exports address space"| node_xml_export
node_client_api -->|"loads certificates"| node_crypto
node_security_policy -->|"uses crypto"| node_crypto
node_app -.->|"uses failover"| node_ha
node_app -->|"uses synchronous API"| node_sync
node_ua_messages -->|"uses types"| node_ua_types

click node_client_api "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/client/client.py"
click node_wire_client "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/client/ua_client.py"
click node_ha "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/client/ha/ha_client.py"
click node_node_api "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/node.py"
click node_subscriptions "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/subscription.py"
click node_node_management "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/manage_nodes.py"
click node_events "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/events.py"
click node_xml_exchange "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/xmlimporter.py"
click node_xml_export "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/xmlexporter.py"
click node_server_api "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/server.py"
click node_address_space "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/address_space.py"
click node_server_transport "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/binary_server_asyncio.py"
click node_history "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/history.py"
click node_ua_types "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/ua/uatypes.py"
click node_ua_messages "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/ua/uaprotocol_auto.py"
click node_crypto "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/crypto/uacrypto.py"
click node_security_policy "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/crypto/security_policies.py"
click node_sync "https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/sync.py"

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_api,node_wire_client,node_ha,node_sync toneBlue
class node_server_api,node_address_space,node_server_transport,node_history toneAmber
class node_node_api,node_subscriptions,node_node_management,node_events,node_xml_exchange,node_xml_export toneMint
class node_ua_types,node_ua_messages toneRose
class node_crypto,node_security_policy,node_app,node_opcpeer toneIndigo
```

## Components

### Client access

- [Client API](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/client/client.py): `asyncua/client/client.py`
- [Binary client](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/client/ua_client.py): `asyncua/client/ua_client.py`
- [High availability](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/client/ha/ha_client.py): `asyncua/client/ha/ha_client.py`
- [Sync wrapper](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/sync.py): `asyncua/sync.py`

### Server runtime

- [Server API](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/server.py): `asyncua/server/server.py`
- [Address space](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/address_space.py): `asyncua/server/address_space.py`
- [Server transport](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/binary_server_asyncio.py): `asyncua/server/binary_server_asyncio.py`
- [History services](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/server/history.py): `asyncua/server/history.py`

### Shared domain API

- [Node access](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/node.py): `asyncua/common/node.py`
- [Subscriptions](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/subscription.py): `asyncua/common/subscription.py`
- [Node management](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/manage_nodes.py): `asyncua/common/manage_nodes.py`
- [Events](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/events.py): `asyncua/common/events.py`
- [XML exchange](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/xmlimporter.py): `asyncua/common/xmlimporter.py`
- [XML export](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/common/xmlexporter.py): `asyncua/common/xmlexporter.py`

### UA protocol

- [UA types](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/ua/uatypes.py): `asyncua/ua/uatypes.py`
- [UA messages](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/ua/uaprotocol_auto.py): `asyncua/ua/uaprotocol_auto.py`

### Security

- [Cryptography](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/crypto/uacrypto.py): `asyncua/crypto/uacrypto.py`
- [Security policies](https://github.com/edgarreis/opcua-asyncio/blob/master/asyncua/crypto/security_policies.py): `asyncua/crypto/security_policies.py`

### Other components

- **Application**
- **OPC UA peer**

## Connections

- Application → Client API: uses
- Client API → Binary client: sends requests (evidence: `asyncua/client/client.py`)
- Client API → Node access: exposes nodes (evidence: `asyncua/client/client.py`)
- Application → Node access: reads and browses
- Application → Subscriptions: subscribes
- Client API → Subscriptions: creates subscriptions (evidence: `asyncua/client/client.py`)
- Binary client → OPC UA peer: exchanges binary (evidence: `asyncua/client/ua_client.py`)
- OPC UA peer → Server transport: connects
- Application → Server API: configures server
- Server API → Address space: manages address space
- Server API → Server transport: starts server (evidence: `asyncua/server/server.py`)
- Application → Node management: adds or removes nodes
- Application → Events: uses event services
- Application → History services: reads history
- Application → XML exchange: imports address space
- Application → XML export: exports address space
- Client API → Cryptography: loads certificates (evidence: `asyncua/client/client.py`)
- Security policies → Cryptography: uses crypto (evidence: `asyncua/crypto/security_policies.py`)
- Application → High availability: uses failover
- Application → Sync wrapper: uses synchronous API
- UA messages → UA types: uses types (evidence: `asyncua/ua/uaprotocol_auto.py`)
