# tronprotocol/tronbox architecture

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

- Interactive diagram: https://gitdiagram.com/tronprotocol/tronbox
- Repository: https://github.com/tronprotocol/tronbox

## Overview

TronBox is a TRON smart-contract development framework. Its main workflow is a developer invoking a CLI command, compiling Solidity into artifacts, then running migrations that deploy contracts through a configured TRON/EVM runtime; the console supports later contract interaction. The graph also preserves project setup, template unboxing, and source flattening. Relationships are limited to excerpted imports/calls and README-documented capabilities; several substantial modules are indexed but unsampled, so their internal links are omitted.

Main entry points: [`src/lib/command.js`](https://github.com/tronprotocol/tronbox/blob/master/src/lib/command.js) (Command dispatch), [`src/components/WorkflowCompile.js`](https://github.com/tronprotocol/tronbox/blob/master/src/components/WorkflowCompile.js) (Compile workflow), [`src/components/Deployer/src/actions/deploy.js`](https://github.com/tronprotocol/tronbox/blob/master/src/components/Deployer/src/actions/deploy.js) (Deployment actions), [`src/lib/console.js`](https://github.com/tronprotocol/tronbox/blob/master/src/lib/console.js) (Interactive console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and project setup"]
  node_entry["CLI entry<br/>[index.js]"]
  node_commands["Command dispatch<br/>[command.js]"]
  node_configuration["Project config<br/>[Config.js]"]
  node_init["Project init<br/>[index.js]"]
  node_boxes["Template boxes"]
  node_flatten["Source flattening<br/>[index.js]"]
end

subgraph group_compile["Compilation and artifacts"]
  node_workflow["Compile workflow<br/>[WorkflowCompile.js]"]
  node_compiler["Solidity compiler<br/>[index.js]"]
  node_profiler["Dependency profiler<br/>[profiler.js]"]
  node_solc["Solc integration<br/>[TronSolc.js]"]
  node_resolver["Source resolver<br/>[index.js]"]
  node_artifacts["Artifact writer<br/>[Artifactor.js]"]
end

subgraph group_deploy["Deployment and runtime"]
  node_migrations["Migration runner<br/>[index.js]"]
  node_deployer["Deployment actions<br/>[deploy.js]"]
  node_provisioner["Contract provisioner<br/>[Provisioner.js]"]
  node_runtime["TRON/EVM runtime<br/>[index.js]"]
end

subgraph group_interact["Contract interaction"]
  node_console["Interactive console<br/>[console.js]"]
  node_repl["REPL manager<br/>[repl.js]"]
  node_contracts["Contract abstraction<br/>[contract.js]"]
end

node_developer(("Developer"))
node_network(("TRON network"))

node_developer -->|"runs commands"| node_entry
node_entry -->|"dispatches"| node_commands
node_commands -.->|"loads config"| node_configuration
node_commands -.->|"runs compile"| node_workflow
node_commands -->|"runs migrations"| node_migrations
node_commands -.->|"opens console"| node_console
node_commands -.->|"initializes project"| node_init
node_commands -->|"unboxes template"| node_boxes
node_commands -.->|"flattens sources"| node_flatten
node_workflow -->|"uses settings"| node_configuration
node_workflow -->|"resolves imports"| node_resolver
node_workflow -->|"compiles sources"| node_compiler
node_workflow -->|"writes artifacts"| node_artifacts
node_compiler -->|"profiles dependencies"| node_profiler
node_compiler -->|"invokes compiler"| node_solc
node_resolver -->|"creates abstractions"| node_contracts
node_resolver -->|"provisions contracts"| node_provisioner
node_migrations -->|"runs deployer"| node_deployer
node_migrations -->|"connects runtime"| node_runtime
node_deployer -->|"deploys contracts"| node_runtime
node_deployer -->|"uses abstraction"| node_contracts
node_deployer -->|"provisions deployment"| node_provisioner
node_runtime -->|"sends transactions"| node_network
node_console -->|"starts REPL"| node_repl
node_console -->|"connects network"| node_runtime
node_console -->|"loads contracts"| node_contracts

click node_entry "https://github.com/tronprotocol/tronbox/blob/master/src/index.js"
click node_commands "https://github.com/tronprotocol/tronbox/blob/master/src/lib/command.js"
click node_configuration "https://github.com/tronprotocol/tronbox/blob/master/src/components/Config.js"
click node_init "https://github.com/tronprotocol/tronbox/blob/master/src/components/Init/index.js"
click node_boxes "https://github.com/tronprotocol/tronbox/tree/master/src/components/Box"
click node_flatten "https://github.com/tronprotocol/tronbox/blob/master/src/components/Flatten/index.js"
click node_workflow "https://github.com/tronprotocol/tronbox/blob/master/src/components/WorkflowCompile.js"
click node_compiler "https://github.com/tronprotocol/tronbox/blob/master/src/components/Compile/index.js"
click node_profiler "https://github.com/tronprotocol/tronbox/blob/master/src/components/Compile/profiler.js"
click node_solc "https://github.com/tronprotocol/tronbox/blob/master/src/components/TronSolc.js"
click node_resolver "https://github.com/tronprotocol/tronbox/blob/master/src/components/Resolver/index.js"
click node_artifacts "https://github.com/tronprotocol/tronbox/blob/master/src/components/Artifactor.js"
click node_migrations "https://github.com/tronprotocol/tronbox/blob/master/src/components/Migrate/index.js"
click node_deployer "https://github.com/tronprotocol/tronbox/blob/master/src/components/Deployer/src/actions/deploy.js"
click node_provisioner "https://github.com/tronprotocol/tronbox/blob/master/src/components/Provisioner.js"
click node_runtime "https://github.com/tronprotocol/tronbox/blob/master/src/components/TronWrap/index.js"
click node_console "https://github.com/tronprotocol/tronbox/blob/master/src/lib/console.js"
click node_repl "https://github.com/tronprotocol/tronbox/blob/master/src/lib/repl.js"
click node_contracts "https://github.com/tronprotocol/tronbox/blob/master/src/components/Contract/contract.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_entry,node_commands,node_configuration,node_init,node_boxes,node_flatten toneBlue
class node_workflow,node_compiler,node_profiler,node_solc,node_resolver,node_artifacts toneAmber
class node_migrations,node_deployer,node_provisioner,node_runtime toneMint
class node_console,node_repl,node_contracts toneRose
class node_developer,node_network toneIndigo
```

## Components

### CLI and project setup

- [CLI entry](https://github.com/tronprotocol/tronbox/blob/master/src/index.js): `src/index.js`
- [Command dispatch](https://github.com/tronprotocol/tronbox/blob/master/src/lib/command.js): `src/lib/command.js`
- [Project config](https://github.com/tronprotocol/tronbox/blob/master/src/components/Config.js): `src/components/Config.js`
- [Project init](https://github.com/tronprotocol/tronbox/blob/master/src/components/Init/index.js): `src/components/Init/index.js`
- [Template boxes](https://github.com/tronprotocol/tronbox/tree/master/src/components/Box): `src/components/Box`
- [Source flattening](https://github.com/tronprotocol/tronbox/blob/master/src/components/Flatten/index.js): `src/components/Flatten/index.js`

### Compilation and artifacts

- [Compile workflow](https://github.com/tronprotocol/tronbox/blob/master/src/components/WorkflowCompile.js): `src/components/WorkflowCompile.js`
- [Solidity compiler](https://github.com/tronprotocol/tronbox/blob/master/src/components/Compile/index.js): `src/components/Compile/index.js`
- [Dependency profiler](https://github.com/tronprotocol/tronbox/blob/master/src/components/Compile/profiler.js): `src/components/Compile/profiler.js`
- [Solc integration](https://github.com/tronprotocol/tronbox/blob/master/src/components/TronSolc.js): `src/components/TronSolc.js`
- [Source resolver](https://github.com/tronprotocol/tronbox/blob/master/src/components/Resolver/index.js): `src/components/Resolver/index.js`
- [Artifact writer](https://github.com/tronprotocol/tronbox/blob/master/src/components/Artifactor.js): `src/components/Artifactor.js`

### Deployment and runtime

- [Migration runner](https://github.com/tronprotocol/tronbox/blob/master/src/components/Migrate/index.js): `src/components/Migrate/index.js`
- [Deployment actions](https://github.com/tronprotocol/tronbox/blob/master/src/components/Deployer/src/actions/deploy.js): `src/components/Deployer/src/actions/deploy.js`
- [Contract provisioner](https://github.com/tronprotocol/tronbox/blob/master/src/components/Provisioner.js): `src/components/Provisioner.js`
- [TRON/EVM runtime](https://github.com/tronprotocol/tronbox/blob/master/src/components/TronWrap/index.js): `src/components/TronWrap/index.js`

### Contract interaction

- [Interactive console](https://github.com/tronprotocol/tronbox/blob/master/src/lib/console.js): `src/lib/console.js`
- [REPL manager](https://github.com/tronprotocol/tronbox/blob/master/src/lib/repl.js): `src/lib/repl.js`
- [Contract abstraction](https://github.com/tronprotocol/tronbox/blob/master/src/components/Contract/contract.js): `src/components/Contract/contract.js`

### Other components

- **Developer**
- **TRON network**

## Connections

- Developer → CLI entry: runs commands
- CLI entry → Command dispatch: dispatches (evidence: `src/index.js`)
- Command dispatch → Project config: loads config
- Command dispatch → Compile workflow: runs compile
- Command dispatch → Migration runner: runs migrations
- Command dispatch → Interactive console: opens console (evidence: `src/lib/console.js`)
- Command dispatch → Project init: initializes project
- Command dispatch → Template boxes: unboxes template
- Command dispatch → Source flattening: flattens sources
- Compile workflow → Project config: uses settings (evidence: `src/components/WorkflowCompile.js`)
- Compile workflow → Source resolver: resolves imports (evidence: `src/components/WorkflowCompile.js`)
- Compile workflow → Solidity compiler: compiles sources (evidence: `src/components/WorkflowCompile.js`)
- Compile workflow → Artifact writer: writes artifacts (evidence: `src/components/WorkflowCompile.js`)
- Solidity compiler → Dependency profiler: profiles dependencies (evidence: `src/components/Compile/index.js`)
- Solidity compiler → Solc integration: invokes compiler (evidence: `src/components/Compile/index.js`)
- Source resolver → Contract abstraction: creates abstractions (evidence: `src/components/Resolver/index.js`)
- Source resolver → Contract provisioner: provisions contracts (evidence: `src/components/Resolver/index.js`)
- Migration runner → Deployment actions: runs deployer (evidence: `src/components/Migrate/index.js`)
- Migration runner → TRON/EVM runtime: connects runtime (evidence: `src/components/Migrate/index.js`)
- Deployment actions → TRON/EVM runtime: deploys contracts (evidence: `src/components/Deployer/src/actions/deploy.js`)
- Deployment actions → Contract abstraction: uses abstraction (evidence: `src/components/Deployer/src/actions/deploy.js`)
- Deployment actions → Contract provisioner: provisions deployment (evidence: `src/components/Deployer/src/actions/deploy.js`)
- TRON/EVM runtime → TRON network: sends transactions
- Interactive console → REPL manager: starts REPL (evidence: `src/lib/console.js`)
- Interactive console → TRON/EVM runtime: connects network (evidence: `src/lib/console.js`)
- Interactive console → Contract abstraction: loads contracts (evidence: `src/lib/console.js`)
