# idena-network/idena-rpc architecture

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

- Interactive diagram: https://gitdiagram.com/idena-network/idena-rpc
- Repository: https://github.com/idena-network/idena-rpc

## Overview

1. This repository is a **single-page React frontend** bootstrapped with Create React App. There is no application backend in the repo; the browser app is the main runtime, and any server-side behavior is limited to static file hosting.

2. The app entry path is standard CRA: `public/index.html` → `src/index.js` → `src/App.jsx`. From there, the top-level app assembles the UI from a small set of reusable components under `src/Components`.

3. The visible UI appears to be centered around **RPC/API interaction** for a blockchain-style platform. The component names and schema files suggest the app lets users pick an API, construct requests, send them, and inspect the response.

4. The main UI subsystem is split into:
   - `Header.jsx` for the page-level shell/navigation,
   - `Board.jsx` for the primary workspace or selector area,
   - `RpcRequest.jsx` for composing and submitting a request,
   - `Output.jsx` for displaying returned data or errors,
   - `Contracts.jsx` for contract-specific interactions or views.

5. The `src/schemas` directory is the clearest architectural boundary in the repo. It contains API/domain definitions for:
   - `accountApi.js`
   - `bcnApi.js`
   - `contractApi.js`
   - `dnaApi.js`
   - `flipApi.js`
   - `ipfsApi.js`
   - `netApi.js`
   plus shared schema aggregators such as `apis.js` and `contracts.js`.
   This strongly implies the UI is data-driven: the form/request components likely consume these schema objects to render supported endpoints and parameters.

6. `src/globals.js` and `src/utils.js` are the shared support layer. They likely hold cross-cutting constants, request helpers, formatting logic, or shared state used by multiple components and schema modules. In an architecture diagram, these sit underneath the component layer and above the domain schema definitions.

7. The key data flow is:
   - user selects an API/contract/function in the UI,
   - `RpcRequest` builds a request from schema metadata,
   - the app sends the request to an external RPC/API endpoint,
   - the response is normalized and rendered in `Output`,
   - `Board`/`Contracts` provide the surrounding navigation or selection context.
   This is a **client-driven request/response flow**, not a server-mediated one.

8. Because the project includes `nginx.conf` and a `Dockerfile`, the production deployment is almost certainly a **static SPA container**: the React build is served by Nginx inside Docker. That means the architectural boundary between “app runtime” and “hosting runtime” is clean: the browser executes React, while Nginx only serves compiled assets and SPA fallback routing.

9. GitHub Actions (`.github/workflows/main.yml`) provides CI around the frontend build/test pipeline. The visible scripts in `package.json` and the CRA defaults imply the workflow likely runs install, test, and build checks before deployment or image publishing.

10. `src/App.test.js` indicates at least basic component-level testing exists, but there is no sign of a separate backend test suite, API mock service, or integration harness in the repo tree. Testing is therefore focused on the React layer.

11. The repo is organized as a **presentation-plus-schema** frontend rather than a state-management-heavy application. There is no visible Redux/store directory, no router directory, and no data-fetching service layer beyond the request-oriented components and schema files. That suggests a relatively compact app where UI, request composition, and endpoint definitions are the main concerns.

12. For an architecture diagram, the important boxes are:
   - Browser SPA entry point,
   - top-level React app/component tree,
   - schema-driven RPC/request builder,
   - output/result viewer,
   - external RPC/API endpoints,
   - static hosting container via Nginx/Docker,
   - CI pipeline in GitHub Actions.
   The primary boundary is between the frontend and the external API services it calls directly.

Main entry points: [`src/schemas/apis.js`](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/apis.js) (APIs), [`src/App.jsx`](https://github.com/idena-network/idena-rpc/blob/master/src/App.jsx) (App), [`src/Components/RpcRequest.jsx`](https://github.com/idena-network/idena-rpc/blob/master/src/Components/RpcRequest.jsx) (RPC Request), [`src/Components/Board.jsx`](https://github.com/idena-network/idena-rpc/blob/master/src/Components/Board.jsx) (Board)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Browser SPA"]
  node_public_index["Index HTML<br/>SPA shell<br/>[index.html]"]
end

subgraph group_frontend["React UI"]
  node_src_index["Entry<br/>React bootstrap<br/>[index.js]"]
  node_app["App<br/>root component<br/>[App.jsx]"]
  node_header["Header<br/>shell component<br/>[Header.jsx]"]
  node_board["Board<br/>workspace component<br/>[Board.jsx]"]
  node_rpc_request["RPC Request<br/>request composer<br/>[RpcRequest.jsx]"]
  node_output["Output<br/>result viewer<br/>[Output.jsx]"]
  node_contracts_ui["Contracts<br/>contract view<br/>[Contracts.js]"]
  node_globals["Globals<br/>shared runtime<br/>[globals.js]"]
  node_utils["Utils<br/>shared helpers<br/>[utils.js]"]
end

subgraph group_data["Schemas"]
  node_apis_schema["APIs<br/>schema index<br/>[apis.js]"]
  node_contracts_schema["Contracts Schema<br/>schema index<br/>[contracts.js]"]
  node_account_api["Account API<br/>endpoint schema<br/>[accountApi.js]"]
  node_bcn_api["BCN API<br/>endpoint schema<br/>[bcnApi.js]"]
  node_contract_api["Contract API<br/>endpoint schema<br/>[contractApi.js]"]
  node_dna_api["DNA API<br/>endpoint schema<br/>[dnaApi.js]"]
  node_flip_api["Flip API<br/>endpoint schema<br/>[flipApi.js]"]
  node_ipfs_api["IPFS API<br/>endpoint schema<br/>[ipfsApi.js]"]
  node_net_api["Net API<br/>endpoint schema<br/>[netApi.js]"]
end

subgraph group_ops["Delivery"]
  node_nginx["Nginx<br/>static host<br/>[nginx.conf]"]
  node_dockerfile["Docker<br/>container build"]
  node_workflow["CI Workflow<br/>build pipeline<br/>[main.yml]"]
end

subgraph group_external["External APIs"]
  node_external_rpc(("RPC/API<br/>remote services"))
end

node_public_index -->|"loads"| node_src_index
node_src_index -->|"mounts"| node_app
node_app -->|"renders"| node_header
node_app -->|"renders"| node_board
node_app -->|"renders"| node_rpc_request
node_app -->|"renders"| node_output
node_app -->|"renders"| node_contracts_ui
node_board -->|"drives"| node_rpc_request
node_board -->|"routes"| node_contracts_ui
node_rpc_request -->|"reads"| node_apis_schema
node_rpc_request -->|"reads"| node_contracts_schema
node_contracts_ui -->|"reads"| node_contracts_schema
node_apis_schema -->|"includes"| node_account_api
node_apis_schema -->|"includes"| node_bcn_api
node_apis_schema -->|"includes"| node_contract_api
node_apis_schema -->|"includes"| node_dna_api
node_apis_schema -->|"includes"| node_flip_api
node_apis_schema -->|"includes"| node_ipfs_api
node_apis_schema -->|"includes"| node_net_api
node_rpc_request -->|"uses"| node_utils
node_output -->|"uses"| node_utils
node_app -->|"uses"| node_globals
node_rpc_request -->|"calls"| node_external_rpc
node_output -->|"shows"| node_external_rpc
node_dockerfile -->|"packages"| node_nginx
node_nginx -->|"hosts"| node_public_index
node_workflow -->|"builds"| node_dockerfile
node_workflow -->|"checks"| node_app

click node_public_index "https://github.com/idena-network/idena-rpc/blob/master/public/index.html"
click node_src_index "https://github.com/idena-network/idena-rpc/blob/master/src/index.js"
click node_app "https://github.com/idena-network/idena-rpc/blob/master/src/App.jsx"
click node_header "https://github.com/idena-network/idena-rpc/blob/master/src/Components/Header.jsx"
click node_board "https://github.com/idena-network/idena-rpc/blob/master/src/Components/Board.jsx"
click node_rpc_request "https://github.com/idena-network/idena-rpc/blob/master/src/Components/RpcRequest.jsx"
click node_output "https://github.com/idena-network/idena-rpc/blob/master/src/Components/Output.jsx"
click node_contracts_ui "https://github.com/idena-network/idena-rpc/blob/master/src/Components/Contracts.js"
click node_globals "https://github.com/idena-network/idena-rpc/blob/master/src/globals.js"
click node_utils "https://github.com/idena-network/idena-rpc/blob/master/src/utils.js"
click node_apis_schema "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/apis.js"
click node_contracts_schema "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/contracts.js"
click node_account_api "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/accountApi.js"
click node_bcn_api "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/bcnApi.js"
click node_contract_api "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/contractApi.js"
click node_dna_api "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/dnaApi.js"
click node_flip_api "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/flipApi.js"
click node_ipfs_api "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/ipfsApi.js"
click node_net_api "https://github.com/idena-network/idena-rpc/blob/master/src/schemas/netApi.js"
click node_nginx "https://github.com/idena-network/idena-rpc/blob/master/nginx.conf"
click node_dockerfile "https://github.com/idena-network/idena-rpc/tree/master/Dockerfile"
click node_workflow "https://github.com/idena-network/idena-rpc/blob/master/.github/workflows/main.yml"

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_public_index toneBlue
class node_src_index,node_app,node_header,node_board,node_rpc_request,node_output,node_contracts_ui,node_globals,node_utils toneAmber
class node_apis_schema,node_contracts_schema,node_account_api,node_bcn_api,node_contract_api,node_dna_api,node_flip_api,node_ipfs_api,node_net_api toneMint
class node_nginx,node_dockerfile,node_workflow toneRose
class node_external_rpc toneIndigo
```

## Components

### Browser SPA

React app runtime in the browser

- [Index HTML](https://github.com/idena-network/idena-rpc/blob/master/public/index.html): SPA shell · CRA host document loaded by the browser · `public/index.html`

### React UI

Top-level app and reusable components

- [Entry](https://github.com/idena-network/idena-rpc/blob/master/src/index.js): React bootstrap · Mounts the React application · `src/index.js`
- [App](https://github.com/idena-network/idena-rpc/blob/master/src/App.jsx): root component · Assembles the page and top-level UI flow · `src/App.jsx`
- [Header](https://github.com/idena-network/idena-rpc/blob/master/src/Components/Header.jsx): shell component · Page-level navigation and framing · `src/Components/Header.jsx`
- [Board](https://github.com/idena-network/idena-rpc/blob/master/src/Components/Board.jsx): workspace component · Primary selection and workspace area · `src/Components/Board.jsx`
- [RPC Request](https://github.com/idena-network/idena-rpc/blob/master/src/Components/RpcRequest.jsx): request composer · Builds and submits API/RPC calls · `src/Components/RpcRequest.jsx`
- [Output](https://github.com/idena-network/idena-rpc/blob/master/src/Components/Output.jsx): result viewer · Renders responses and errors · `src/Components/Output.jsx`
- [Contracts](https://github.com/idena-network/idena-rpc/blob/master/src/Components/Contracts.js): contract view · Contract-specific interactions and views · `src/Components/Contracts.js`
- [Globals](https://github.com/idena-network/idena-rpc/blob/master/src/globals.js): shared runtime · Cross-cutting constants and shared helpers · `src/globals.js`
- [Utils](https://github.com/idena-network/idena-rpc/blob/master/src/utils.js): shared helpers · Common formatting and request support logic · `src/utils.js`

### Schemas

API and contract schema definitions

- [APIs](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/apis.js): schema index · Aggregates available API schema definitions · `src/schemas/apis.js`
- [Contracts Schema](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/contracts.js): schema index · Aggregates contract schema definitions · `src/schemas/contracts.js`
- [Account API](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/accountApi.js): endpoint schema · Account-related RPC/API schema · `src/schemas/accountApi.js`
- [BCN API](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/bcnApi.js): endpoint schema · Blockchain/network API schema · `src/schemas/bcnApi.js`
- [Contract API](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/contractApi.js): endpoint schema · Contract interaction schema · `src/schemas/contractApi.js`
- [DNA API](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/dnaApi.js): endpoint schema · DNA-related RPC/API schema · `src/schemas/dnaApi.js`
- [Flip API](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/flipApi.js): endpoint schema · Flip game or app API schema · `src/schemas/flipApi.js`
- [IPFS API](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/ipfsApi.js): endpoint schema · IPFS-related API schema · `src/schemas/ipfsApi.js`
- [Net API](https://github.com/idena-network/idena-rpc/blob/master/src/schemas/netApi.js): endpoint schema · Network and connectivity API schema · `src/schemas/netApi.js`

### Delivery

Static hosting and CI pipeline

- [Nginx](https://github.com/idena-network/idena-rpc/blob/master/nginx.conf): static host · Serves the built SPA and handles fallback routing · `nginx.conf`
- [Docker](https://github.com/idena-network/idena-rpc/tree/master/Dockerfile): container build · Builds the static SPA image · `Dockerfile`
- [CI Workflow](https://github.com/idena-network/idena-rpc/blob/master/.github/workflows/main.yml): build pipeline · Runs frontend checks and build in GitHub Actions · `.github/workflows/main.yml`

### External APIs

Remote RPC/API services called by the app

- **RPC/API**: remote services · External blockchain-style endpoints called by the app

## Connections

- Index HTML → Entry: loads · Browser loads the React entrypoint
- Entry → App: mounts · Bootstraps the root app component
- App → Header: renders · App composes the page shell
- App → Board: renders · App composes the main workspace
- App → RPC Request: renders · App includes request composer UI
- App → Output: renders · App includes result viewer UI
- App → Contracts: renders · App includes contract-specific UI
- Board → RPC Request: drives · Selection context feeds request composition
- Board → Contracts: routes · Workspace can switch into contract views
- RPC Request → APIs: reads · Request builder consumes API metadata
- RPC Request → Contracts Schema: reads · Request builder consumes contract metadata
- Contracts → Contracts Schema: reads · Contract views are schema-driven
- APIs → Account API: includes · Aggregated API definitions
- APIs → BCN API: includes · Aggregated API definitions
- APIs → Contract API: includes · Aggregated API definitions
- APIs → DNA API: includes · Aggregated API definitions
- APIs → Flip API: includes · Aggregated API definitions
- APIs → IPFS API: includes · Aggregated API definitions
- APIs → Net API: includes · Aggregated API definitions
- RPC Request → Utils: uses · Shared helpers support request construction
- Output → Utils: uses · Shared helpers support formatting and normalization
- App → Globals: uses · App uses shared runtime constants
- RPC Request → RPC/API: calls · Sends direct requests to remote endpoints
- Output → RPC/API: shows · Displays responses from remote endpoints
- Docker → Nginx: packages · Container image serves static assets through Nginx
- Nginx → Index HTML: hosts · Static hosting serves the built SPA
- CI Workflow → Docker: builds · CI validates or publishes the frontend container
- CI Workflow → App: checks · CI runs frontend build/test checks
