# ramachandrapetla/fele-simulator architecture

> Architecture diagram of the GitHub repository ramachandrapetla/fele-simulator, 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/ramachandrapetla/fele-simulator
- Repository: https://github.com/ramachandrapetla/fele-simulator

## Overview

Fele Simulator provides CLI and HTTP interfaces for managing simulated Fabric networks, channels, organizations, users, and chaincode invocations. The principal workflow accepts a CLI/API request, routes it to a management or invocation handler, then delegates network operations to scripts/services or chaincode arguments to invocation code. Local-organization administration and CA enrollment are distinct capabilities, with CouchDB supporting persisted simulator state. The graph follows documented features and shown call ownership; several service internals and integrations are unsampled, so those links are omitted rather than inferred.

Main entry points: [`fele-client-api/src/cli/command.js`](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/command.js) (Interactive CLI), [`fele-client-api/src/routes/routes.js`](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/routes/routes.js) (API route mount), [`fele-client-api/src/controllers/channel.controller.js`](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/channel.controller.js) (Channel and network API), [`fele-client-api/src/server.js`](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/server.js) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["Interactive CLI<br/>[command.js]"]
  node_http["HTTP server<br/>[server.js]"]
  node_routes["API route mount<br/>[routes.js]"]
  node_channel_api["Channel and network API"]
  node_chaincode_api["Chaincode API"]
  node_ca_api["CA user API<br/>[ca.controller.js]"]
  node_user_api["User API<br/>[user.controller.js]"]
end

subgraph group_management["Fabric management"]
  node_network_cli["Network commands<br/>[network.js]"]
  node_channel_cli["Channel commands<br/>[channel.js]"]
  node_channel_service["Channel operations<br/>[channel.js]"]
  node_network_service["Network operations<br/>[network.js]"]
end

subgraph group_identity["Identity and organizations"]
  node_ca_cli["CA commands<br/>[ca.js]"]
  node_org_cli["Fele organization commands<br/>[feleOrg.js]"]
  node_localorg_cli["Local org commands<br/>[localOrg.js]"]
  node_ca_service["CA enrollment<br/>[ca.js]"]
  node_org_service["Organization operations<br/>[organization.js]"]
  node_localorg_api["Local organization API"]
  node_localorg_service["Local org state"]
  node_localorg_routes["Local org routes"]
end

subgraph group_runtime["Chaincode runtime"]
  node_chaincode_cli["Chaincode commands<br/>[chaincode.js]"]
  node_chaincode_service["Chaincode operations<br/>[chaincode.js]"]
  node_asset_contract["Employee asset contract<br/>[EmployeeAsset.js]"]
  node_contract_context["Contract context<br/>[Context.js]"]
end

subgraph group_state["Persistence and support"]
  node_couch[("CouchDB")]
  node_db_access["CouchDB access<br/>[db.js]"]
  node_channel_validator["Channel validation"]
  node_logger["Logger<br/>[logger.js]"]
end

node_cli_user(("CLI user"))
node_api_client(("API client"))

node_cli_user -->|"runs commands"| node_cli
node_cli -->|"dispatches network"| node_network_cli
node_cli -->|"dispatches channel"| node_channel_cli
node_cli -->|"dispatches invocation"| node_chaincode_cli
node_cli -->|"dispatches CA"| node_ca_cli
node_cli -->|"dispatches organization"| node_org_cli
node_cli -->|"dispatches local org"| node_localorg_cli
node_api_client -->|"sends requests"| node_http
node_http -->|"mounts routes"| node_routes
node_routes -.->|"routes requests"| node_channel_api
node_routes -.->|"routes requests"| node_chaincode_api
node_routes -.->|"routes requests"| node_ca_api
node_routes -.->|"routes requests"| node_user_api
node_channel_api -.->|"creates network"| node_network_service
node_channel_api -.->|"creates channel"| node_channel_service
node_chaincode_api -.->|"invokes chaincode"| node_chaincode_service
node_channel_api -.->|"validates payload"| node_channel_validator
node_ca_api -.->|"registers and enrolls"| node_ca_service
node_localorg_routes -.->|"routes requests"| node_localorg_api
node_localorg_api -.->|"delegates operations"| node_localorg_service
node_db_access -->|"reads and writes"| node_couch
node_cli -->|"loads local state"| node_db_access
node_cli -->|"logs activity"| node_logger
node_channel_validator -->|"logs validation"| node_logger

click node_cli "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/command.js"
click node_http "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/server.js"
click node_routes "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/routes/routes.js"
click node_channel_api "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/channel.controller.js"
click node_chaincode_api "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/chaincode.controller.js"
click node_ca_api "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/ca.controller.js"
click node_user_api "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/user.controller.js"
click node_network_cli "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/network.js"
click node_channel_cli "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/channel.js"
click node_chaincode_cli "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/chaincode.js"
click node_channel_service "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/channel.js"
click node_network_service "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/network.js"
click node_chaincode_service "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/chaincode.js"
click node_ca_cli "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/ca.js"
click node_org_cli "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/feleOrg.js"
click node_localorg_cli "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/localOrg.js"
click node_ca_service "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/ca.js"
click node_org_service "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/organization.js"
click node_localorg_api "https://github.com/ramachandrapetla/fele-simulator/blob/master/local-organization-api/src/controllers/localorganization.handler.js"
click node_localorg_service "https://github.com/ramachandrapetla/fele-simulator/blob/master/local-organization-api/src/services/LocalOrganization.js"
click node_localorg_routes "https://github.com/ramachandrapetla/fele-simulator/blob/master/local-organization-api/src/routes/localorganization.route.js"
click node_asset_contract "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/tmpworkspaceforuser/EmployeeAsset/lib/EmployeeAsset.js"
click node_contract_context "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/smart-contract/Context.js"
click node_db_access "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/utils/db.js"
click node_channel_validator "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/validators/channelValidator.js"
click node_logger "https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/utils/logger.js"

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_cli,node_http,node_routes,node_channel_api,node_chaincode_api,node_ca_api,node_user_api,node_cli_user,node_api_client toneBlue
class node_network_cli,node_channel_cli,node_channel_service,node_network_service toneAmber
class node_ca_cli,node_org_cli,node_localorg_cli,node_ca_service,node_org_service,node_localorg_api,node_localorg_service,node_localorg_routes toneMint
class node_chaincode_cli,node_chaincode_service,node_asset_contract,node_contract_context toneRose
class node_couch,node_db_access,node_channel_validator,node_logger toneIndigo
```

## Components

### User interfaces

- [Interactive CLI](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/command.js): `fele-client-api/src/cli/command.js`
- [HTTP server](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/server.js): `fele-client-api/src/server.js`
- [API route mount](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/routes/routes.js): `fele-client-api/src/routes/routes.js`
- [Channel and network API](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/channel.controller.js): `fele-client-api/src/controllers/channel.controller.js`
- [Chaincode API](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/chaincode.controller.js): `fele-client-api/src/controllers/chaincode.controller.js`
- [CA user API](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/ca.controller.js): `fele-client-api/src/controllers/ca.controller.js`
- [User API](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/controllers/user.controller.js): `fele-client-api/src/controllers/user.controller.js`

### Fabric management

- [Network commands](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/network.js): `fele-client-api/src/cli/scripts/network.js`
- [Channel commands](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/channel.js): `fele-client-api/src/cli/scripts/channel.js`
- [Channel operations](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/channel.js): `fele-client-api/src/services/channel.js`
- [Network operations](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/network.js): `fele-client-api/src/services/network.js`

### Identity and organizations

- [CA commands](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/ca.js): `fele-client-api/src/cli/scripts/ca.js`
- [Fele organization commands](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/feleOrg.js): `fele-client-api/src/cli/scripts/feleOrg.js`
- [Local org commands](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/localOrg.js): `fele-client-api/src/cli/scripts/localOrg.js`
- [CA enrollment](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/ca.js): `fele-client-api/src/services/ca.js`
- [Organization operations](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/organization.js): `fele-client-api/src/services/organization.js`
- [Local organization API](https://github.com/ramachandrapetla/fele-simulator/blob/master/local-organization-api/src/controllers/localorganization.handler.js): `local-organization-api/src/controllers/localorganization.handler.js`
- [Local org state](https://github.com/ramachandrapetla/fele-simulator/blob/master/local-organization-api/src/services/LocalOrganization.js): `local-organization-api/src/services/LocalOrganization.js`
- [Local org routes](https://github.com/ramachandrapetla/fele-simulator/blob/master/local-organization-api/src/routes/localorganization.route.js): `local-organization-api/src/routes/localorganization.route.js`

### Chaincode runtime

- [Chaincode commands](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/cli/scripts/chaincode.js): `fele-client-api/src/cli/scripts/chaincode.js`
- [Chaincode operations](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/chaincode.js): `fele-client-api/src/services/chaincode.js`
- [Employee asset contract](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/tmpworkspaceforuser/EmployeeAsset/lib/EmployeeAsset.js): `fele-client-api/src/tmpworkspaceforuser/EmployeeAsset/lib/EmployeeAsset.js`
- [Contract context](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/services/smart-contract/Context.js): `fele-client-api/src/services/smart-contract/Context.js`

### Persistence and support

- **CouchDB**
- [CouchDB access](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/utils/db.js): `fele-client-api/src/utils/db.js`
- [Channel validation](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/validators/channelValidator.js): `fele-client-api/src/validators/channelValidator.js`
- [Logger](https://github.com/ramachandrapetla/fele-simulator/blob/master/fele-client-api/src/utils/logger.js): `fele-client-api/src/utils/logger.js`

### Other components

- **CLI user**
- **API client**

## Connections

- CLI user → Interactive CLI: runs commands (evidence: `fele-client-api/src/cli/command.js`)
- Interactive CLI → Network commands: dispatches network (evidence: `fele-client-api/src/cli/command.js`)
- Interactive CLI → Channel commands: dispatches channel (evidence: `fele-client-api/src/cli/command.js`)
- Interactive CLI → Chaincode commands: dispatches invocation (evidence: `fele-client-api/src/cli/command.js`)
- Interactive CLI → CA commands: dispatches CA (evidence: `fele-client-api/src/cli/command.js`)
- Interactive CLI → Fele organization commands: dispatches organization (evidence: `fele-client-api/src/cli/command.js`)
- Interactive CLI → Local org commands: dispatches local org (evidence: `fele-client-api/src/cli/command.js`)
- API client → HTTP server: sends requests (evidence: `fele-client-api/src/server.js`)
- HTTP server → API route mount: mounts routes (evidence: `fele-client-api/src/server.js`)
- API route mount → Channel and network API: routes requests (evidence: `fele-client-api/src/routes/routes.js`)
- API route mount → Chaincode API: routes requests (evidence: `fele-client-api/src/routes/routes.js`)
- API route mount → CA user API: routes requests (evidence: `fele-client-api/src/routes/routes.js`)
- API route mount → User API: routes requests (evidence: `fele-client-api/src/routes/routes.js`)
- Channel and network API → Network operations: creates network
- Channel and network API → Channel operations: creates channel
- Chaincode API → Chaincode operations: invokes chaincode
- Channel and network API → Channel validation: validates payload (evidence: `fele-client-api/src/routes/channel.route.js`)
- CA user API → CA enrollment: registers and enrolls
- Local org routes → Local organization API: routes requests
- Local organization API → Local org state: delegates operations
- CouchDB access → CouchDB: reads and writes (evidence: `fele-client-api/src/utils/db.js`)
- Interactive CLI → CouchDB access: loads local state (evidence: `fele-client-api/src/cli/command.js`)
- Interactive CLI → Logger: logs activity (evidence: `fele-client-api/src/cli/command.js`)
- Channel validation → Logger: logs validation (evidence: `fele-client-api/src/validators/channelValidator.js`)
