# whisdev/rust-copy-trading architecture

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

- Interactive diagram: https://gitdiagram.com/whisdev/rust-copy-trading
- Repository: https://github.com/whisdev/rust-copy-trading

## Overview

This repository presents a Solana copytrading bot: its intended workflow is to start from configuration, monitor target-wallet trades, identify swaps, then submit corresponding trades through DEX and fast-transaction integrations. The checked-in tree is incomplete relative to the README and entry point: monitor, config, and several documented integrations are absent. Edges for those stages reflect README documentation, not inspected implementations; the separate barter_trade tree is not part of the root package’s declared runtime.

Main entry points: [`src/engine/mod.rs`](https://github.com/whisdev/rust-copy-trading/blob/main/src/engine/mod.rs) (Swap execution), [`src/main.rs`](https://github.com/whisdev/rust-copy-trading/blob/main/src/main.rs) (Bot entry), [`src/services/mod.rs`](https://github.com/whisdev/rust-copy-trading/blob/main/src/services/mod.rs) (Shred stream), [`src/core/token.rs`](https://github.com/whisdev/rust-copy-trading/blob/main/src/core/token.rs) (Token model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Bot entry"]
  node_main["Bot entry<br/>[main.rs]"]
  node_config["Runtime config"]
end

subgraph group_copy["Copy workflow"]
  node_monitor["Trade monitor"]
  node_swap["Swap execution<br/>[mod.rs]"]
  node_token["Token model<br/>[token.rs]"]
  node_transaction["Transaction logic<br/>[tx.rs]"]
end

subgraph group_integrations["Chain integrations"]
  node_pump["Pump.fun DEX<br/>[pump_fun.rs]"]
  node_raydium["Raydium DEX<br/>[raydium.rs]"]
  node_jito["Jito service"]
  node_shred["Shred stream<br/>[mod.rs]"]
end

node_operator(("Operator"))
node_solana(("Solana network"))
node_targets[("Target wallets")]

node_operator -->|"starts"| node_main
node_main -->|"loads"| node_config
node_main -->|"starts"| node_monitor
node_targets -->|"wallet trades"| node_monitor
node_solana -.->|"market feed"| node_monitor
node_monitor -.->|"requests copies"| node_swap
node_swap -.->|"uses model"| node_token
node_swap -.->|"builds transaction"| node_transaction
node_swap -.->|"routes swap"| node_pump
node_swap -.->|"routes swap"| node_raydium
node_swap -.->|"submits fast"| node_jito
node_solana -.->|"streams shreds"| node_shred
node_shred -.->|"feeds trades"| node_monitor
node_jito -.->|"submits transaction"| node_solana

click node_main "https://github.com/whisdev/rust-copy-trading/blob/main/src/main.rs"
click node_swap "https://github.com/whisdev/rust-copy-trading/blob/main/src/engine/mod.rs"
click node_token "https://github.com/whisdev/rust-copy-trading/blob/main/src/core/token.rs"
click node_transaction "https://github.com/whisdev/rust-copy-trading/blob/main/src/core/tx.rs"
click node_pump "https://github.com/whisdev/rust-copy-trading/blob/main/src/dex/pump_fun.rs"
click node_raydium "https://github.com/whisdev/rust-copy-trading/blob/main/src/dex/raydium.rs"
click node_shred "https://github.com/whisdev/rust-copy-trading/blob/main/src/services/mod.rs"

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_main,node_config toneBlue
class node_monitor,node_swap,node_token,node_transaction,node_targets toneAmber
class node_pump,node_raydium,node_jito,node_shred toneMint
class node_operator,node_solana toneIndigo
```

## Components

### Bot entry

- [Bot entry](https://github.com/whisdev/rust-copy-trading/blob/main/src/main.rs): `src/main.rs`
- **Runtime config**

### Copy workflow

- **Trade monitor**
- [Swap execution](https://github.com/whisdev/rust-copy-trading/blob/main/src/engine/mod.rs): `src/engine/mod.rs`
- [Token model](https://github.com/whisdev/rust-copy-trading/blob/main/src/core/token.rs): `src/core/token.rs`
- [Transaction logic](https://github.com/whisdev/rust-copy-trading/blob/main/src/core/tx.rs): `src/core/tx.rs`

### Chain integrations

- [Pump.fun DEX](https://github.com/whisdev/rust-copy-trading/blob/main/src/dex/pump_fun.rs): `src/dex/pump_fun.rs`
- [Raydium DEX](https://github.com/whisdev/rust-copy-trading/blob/main/src/dex/raydium.rs): `src/dex/raydium.rs`
- **Jito service**
- [Shred stream](https://github.com/whisdev/rust-copy-trading/blob/main/src/services/mod.rs): `src/services/mod.rs`

### Other components

- **Operator**
- **Solana network**
- **Target wallets**

## Connections

- Operator → Bot entry: starts
- Bot entry → Runtime config: loads
- Bot entry → Trade monitor: starts
- Target wallets → Trade monitor: wallet trades
- Solana network → Trade monitor: market feed
- Trade monitor → Swap execution: requests copies
- Swap execution → Token model: uses model
- Swap execution → Transaction logic: builds transaction
- Swap execution → Pump.fun DEX: routes swap
- Swap execution → Raydium DEX: routes swap
- Swap execution → Jito service: submits fast
- Solana network → Shred stream: streams shreds
- Shred stream → Trade monitor: feeds trades
- Jito service → Solana network: submits transaction
