# ratio1/edge_node architecture

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

- Interactive diagram: https://gitdiagram.com/ratio1/edge_node
- Repository: https://github.com/ratio1/edge_node

## Overview

Ratio1 Edge Node is a runnable edge runtime that joins the Ratio1 network, executes upstream pipeline contracts, exposes operational APIs, and hosts extensible business, data, and serving modules. The principal workflow is operator startup or workload submission → device runtime → naeural_core execution → selected extension/plugin → inference, security, storage, or deployment result → persisted cache/API response. The graph preserves documented capabilities; several extension relationships remain unconnected where sampled excerpts did not establish their callers.

Main entry points: [`extensions/business/container_apps/sync/manager.py`](https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/sync/manager.py) (Volume Sync), [`extensions/business/r1fs/r1fs_manager_api.py`](https://github.com/ratio1/edge_node/blob/develop/extensions/business/r1fs/r1fs_manager_api.py) (R1FS API), [`device.py`](https://github.com/ratio1/edge_node/blob/develop/device.py) (Device Runtime), [`cmds/device_comms.py`](https://github.com/ratio1/edge_node/blob/develop/cmds/device_comms.py) (Node Commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Node Runtime"]
  node_device_runtime["Device Runtime<br/>[device.py]"]
  node_runtime_constants["Runtime Constants<br/>[constants.py]"]
  node_core_engine["Core Engine"]
  node_ops_commands["Node Commands<br/>[device_comms.py]"]
end

subgraph group_extensions["Business Extensions"]
  node_deeploy_api["Deeploy Manager"]
  node_container_runner["Container App Runner"]
  node_worker_runner["Git Worker Runner"]
  node_volume_sync["Volume Sync<br/>[manager.py]"]
  node_volume_reset["Volume Reset<br/>[manager.py]"]
  node_env_overrides["Environment Overrides<br/>[manager.py]"]
  node_tunnel_manager["Tunnel Manager<br/>[tunnels_manager.py]"]
  node_dauth_manager["dAuth Manager<br/>[dauth_manager.py]"]
end

subgraph group_security["Security Operations"]
  node_redmesh_worker["Pentest Worker<br/>[pentest_worker.py]"]
  node_redmesh_query["Security Query<br/>[query.py]"]
end

subgraph group_ml["ML and Data"]
  node_serving_adapters["Inference Adapters"]
  node_serving_models["Serving Models"]
  node_data_listeners["Data Listeners"]
end

subgraph group_storage["Storage Integrations"]
  node_r1fs_api["R1FS API"]
  node_cstore_api["ChainStore API"]
  node_local_cache[("Local Cache")]
  node_r1fs_store[("R1FS Store")]
  node_chainstore[("ChainStore")]
end

node_operator(("Operator"))
node_redmesh_target(("Scan Target"))
node_ratio_network{{"Ratio1 Network"}}
node_cloudflare{{"Cloudflare"}}
node_github{{"GitHub"}}

node_operator -->|"starts node"| node_device_runtime
node_operator -->|"runs commands"| node_ops_commands
node_device_runtime -->|"starts runtime"| node_core_engine
node_runtime_constants -->|"extends configuration"| node_core_engine
node_core_engine -->|"joins network"| node_ratio_network
node_core_engine -->|"loads extension"| node_deeploy_api
node_core_engine -->|"loads extension"| node_container_runner
node_core_engine -->|"loads extension"| node_tunnel_manager
node_core_engine -->|"loads extension"| node_dauth_manager
node_core_engine -->|"loads adapters"| node_serving_adapters
node_core_engine -->|"loads listeners"| node_data_listeners
node_deeploy_api -->|"persists metadata"| node_chainstore
node_worker_runner -.->|"polls commits"| node_github
node_volume_sync -->|"publishes snapshots"| node_r1fs_store
node_volume_sync -->|"records manifests"| node_chainstore
node_volume_reset -->|"resets volumes"| node_local_cache
node_env_overrides -->|"persists overrides"| node_local_cache
node_tunnel_manager -.->|"manages tunnels"| node_cloudflare
node_redmesh_worker -->|"scans target"| node_redmesh_target
node_r1fs_api -->|"uploads files"| node_r1fs_store
node_r1fs_api -->|"deletes files"| node_r1fs_store
node_cstore_api -->|"reads and writes"| node_chainstore
node_ops_commands -->|"reads status"| node_local_cache
node_serving_adapters -->|"runs inference"| node_serving_models

click node_device_runtime "https://github.com/ratio1/edge_node/blob/develop/device.py"
click node_runtime_constants "https://github.com/ratio1/edge_node/blob/develop/constants.py"
click node_ops_commands "https://github.com/ratio1/edge_node/blob/develop/cmds/device_comms.py"
click node_deeploy_api "https://github.com/ratio1/edge_node/blob/develop/extensions/business/deeploy/deeploy_manager_api.py"
click node_container_runner "https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/container_app_runner.py"
click node_worker_runner "https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/worker_app_runner.py"
click node_volume_sync "https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/sync/manager.py"
click node_volume_reset "https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/reset/manager.py"
click node_env_overrides "https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/env_overrides/manager.py"
click node_tunnel_manager "https://github.com/ratio1/edge_node/blob/develop/extensions/business/tunnels/tunnels_manager.py"
click node_dauth_manager "https://github.com/ratio1/edge_node/blob/develop/extensions/business/dauth/dauth_manager.py"
click node_redmesh_worker "https://github.com/ratio1/edge_node/blob/develop/extensions/business/cybersec/red_mesh/worker/pentest_worker.py"
click node_redmesh_query "https://github.com/ratio1/edge_node/blob/develop/extensions/business/cybersec/red_mesh/services/query.py"
click node_serving_adapters "https://github.com/ratio1/edge_node/tree/develop/extensions/business/edge_inference_api"
click node_serving_models "https://github.com/ratio1/edge_node/tree/develop/extensions/serving/default_inference"
click node_data_listeners "https://github.com/ratio1/edge_node/tree/develop/extensions/data"
click node_r1fs_api "https://github.com/ratio1/edge_node/blob/develop/extensions/business/r1fs/r1fs_manager_api.py"
click node_cstore_api "https://github.com/ratio1/edge_node/blob/develop/extensions/business/cstore/cstore_manager_api.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_device_runtime,node_runtime_constants,node_core_engine,node_ops_commands toneBlue
class node_deeploy_api,node_container_runner,node_worker_runner,node_volume_sync,node_volume_reset,node_env_overrides,node_tunnel_manager,node_dauth_manager toneAmber
class node_redmesh_worker,node_redmesh_query toneMint
class node_serving_adapters,node_serving_models,node_data_listeners toneRose
class node_r1fs_api,node_cstore_api,node_local_cache,node_r1fs_store,node_chainstore,node_operator,node_redmesh_target,node_ratio_network,node_cloudflare,node_github toneIndigo
```

## Components

### Node Runtime

- [Device Runtime](https://github.com/ratio1/edge_node/blob/develop/device.py): `device.py`
- [Runtime Constants](https://github.com/ratio1/edge_node/blob/develop/constants.py): `constants.py`
- **Core Engine**
- [Node Commands](https://github.com/ratio1/edge_node/blob/develop/cmds/device_comms.py): `cmds/device_comms.py`

### Business Extensions

- [Deeploy Manager](https://github.com/ratio1/edge_node/blob/develop/extensions/business/deeploy/deeploy_manager_api.py): `extensions/business/deeploy/deeploy_manager_api.py`
- [Container App Runner](https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/container_app_runner.py): `extensions/business/container_apps/container_app_runner.py`
- [Git Worker Runner](https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/worker_app_runner.py): `extensions/business/container_apps/worker_app_runner.py`
- [Volume Sync](https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/sync/manager.py): `extensions/business/container_apps/sync/manager.py`
- [Volume Reset](https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/reset/manager.py): `extensions/business/container_apps/reset/manager.py`
- [Environment Overrides](https://github.com/ratio1/edge_node/blob/develop/extensions/business/container_apps/env_overrides/manager.py): `extensions/business/container_apps/env_overrides/manager.py`
- [Tunnel Manager](https://github.com/ratio1/edge_node/blob/develop/extensions/business/tunnels/tunnels_manager.py): `extensions/business/tunnels/tunnels_manager.py`
- [dAuth Manager](https://github.com/ratio1/edge_node/blob/develop/extensions/business/dauth/dauth_manager.py): `extensions/business/dauth/dauth_manager.py`

### Security Operations

- [Pentest Worker](https://github.com/ratio1/edge_node/blob/develop/extensions/business/cybersec/red_mesh/worker/pentest_worker.py): `extensions/business/cybersec/red_mesh/worker/pentest_worker.py`
- [Security Query](https://github.com/ratio1/edge_node/blob/develop/extensions/business/cybersec/red_mesh/services/query.py): `extensions/business/cybersec/red_mesh/services/query.py`

### ML and Data

- [Inference Adapters](https://github.com/ratio1/edge_node/tree/develop/extensions/business/edge_inference_api): `extensions/business/edge_inference_api`
- [Serving Models](https://github.com/ratio1/edge_node/tree/develop/extensions/serving/default_inference): `extensions/serving/default_inference`
- [Data Listeners](https://github.com/ratio1/edge_node/tree/develop/extensions/data): `extensions/data`

### Storage Integrations

- [R1FS API](https://github.com/ratio1/edge_node/blob/develop/extensions/business/r1fs/r1fs_manager_api.py): `extensions/business/r1fs/r1fs_manager_api.py`
- [ChainStore API](https://github.com/ratio1/edge_node/blob/develop/extensions/business/cstore/cstore_manager_api.py): `extensions/business/cstore/cstore_manager_api.py`
- **Local Cache**
- **R1FS Store**
- **ChainStore**

### Other components

- **Operator**
- **Scan Target**
- **Ratio1 Network**
- **Cloudflare**
- **GitHub**

## Connections

- Operator → Device Runtime: starts node
- Operator → Node Commands: runs commands
- Device Runtime → Core Engine: starts runtime
- Runtime Constants → Core Engine: extends configuration
- Core Engine → Ratio1 Network: joins network
- Core Engine → Deeploy Manager: loads extension
- Core Engine → Container App Runner: loads extension
- Core Engine → Tunnel Manager: loads extension
- Core Engine → dAuth Manager: loads extension
- Core Engine → Inference Adapters: loads adapters
- Core Engine → Data Listeners: loads listeners
- Deeploy Manager → ChainStore: persists metadata
- Git Worker Runner → GitHub: polls commits
- Volume Sync → R1FS Store: publishes snapshots
- Volume Sync → ChainStore: records manifests
- Volume Reset → Local Cache: resets volumes
- Environment Overrides → Local Cache: persists overrides
- Tunnel Manager → Cloudflare: manages tunnels
- Pentest Worker → Scan Target: scans target
- R1FS API → R1FS Store: uploads files
- R1FS API → R1FS Store: deletes files
- ChainStore API → ChainStore: reads and writes
- Node Commands → Local Cache: reads status
- Inference Adapters → Serving Models: runs inference
