# richardawe/energytrm architecture

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

- Interactive diagram: https://gitdiagram.com/richardawe/energytrm
- Repository: https://github.com/richardawe/energytrm

## Overview

This Laravel application is an energy trading and risk management system. Users enter through web routes to manage physical and financial trades, then work with reference data, market prices, invoicing and settlements, and risk analysis. Separate capabilities include operational nominations and shipments, administrative access controls and audit logs, and training videos with quizzes. The sampled controllers show direct model reads and writes; the tree supports the broader feature map, but unsampled route wiring and several subsystem internals are not asserted.

Main entry points: [`routes/web.php`](https://github.com/richardawe/energytrm/blob/main/routes/web.php) (Web routes), [`app/Models/Trade.php`](https://github.com/richardawe/energytrm/blob/main/app/Models/Trade.php) (Domain models), [`app/Http/Controllers/DashboardController.php`](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/DashboardController.php) (Dashboard), [`app/Http/Controllers/Master/PipelineController.php`](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Master/PipelineController.php) (Master data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web access"]
  node_routes["Web routes<br/>[web.php]"]
  node_dashboard["Dashboard"]
end

subgraph group_reference["Reference and market data"]
  node_masters["Master data"]
  node_market["Market data"]
  node_marketfeeds["Market feed services<br/>[EiaService.php]"]
  node_feedcommands["Feed commands"]
  node_fxcommands["FX command<br/>[FetchFxRates.php]"]
end

subgraph group_trading["Trading and finance"]
  node_trade["Physical trades"]
  node_financial["Financial trades"]
  node_models["Domain models<br/>[Trade.php]"]
end

subgraph group_operations["Operations and risk"]
  node_invoices["Invoices"]
  node_settlements["Settlements"]
  node_shipments["Shipments and nominations"]
  node_checklists["EOB checklists"]
  node_risk["Risk analysis<br/>[VarController.php]"]
  node_riskreports["Exposure and reports"]
end

subgraph group_support["Administration and training"]
  node_admin["User administration<br/>[UserController.php]"]
  node_audit["Audit logs"]
  node_training["Training and quizzes"]
end

node_user(("User"))
node_store[("Database<br/>[database.php]")]

node_user -->|"requests"| node_routes
node_routes -->|"dispatches"| node_trade
node_routes -->|"dispatches"| node_financial
node_routes -->|"dispatches"| node_masters
node_routes -->|"dispatches"| node_dashboard
node_routes -->|"dispatches"| node_invoices
node_routes -->|"dispatches"| node_settlements
node_routes -->|"dispatches"| node_shipments
node_routes -->|"dispatches"| node_checklists
node_routes -->|"dispatches"| node_risk
node_routes -->|"dispatches"| node_riskreports
node_routes -->|"dispatches"| node_admin
node_routes -->|"dispatches"| node_audit
node_routes -->|"dispatches"| node_training
node_trade -->|"reads and writes"| node_models
node_financial -->|"reads and writes"| node_models
node_masters -->|"reads and writes"| node_models
node_dashboard -->|"reads"| node_models
node_invoices -->|"reads and writes"| node_models
node_settlements -->|"reads and writes"| node_models
node_shipments -->|"reads and writes"| node_models
node_checklists -->|"reads and writes"| node_models
node_risk -->|"reads"| node_models
node_riskreports -->|"reads"| node_models
node_admin -->|"reads and writes"| node_models
node_audit -->|"reads"| node_models
node_training -->|"reads and writes"| node_models
node_models -->|"persists via ORM"| node_store

click node_routes "https://github.com/richardawe/energytrm/blob/main/routes/web.php"
click node_trade "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Trades/TradeController.php"
click node_financial "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Financials/FinancialTradeController.php"
click node_masters "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Master/PipelineController.php"
click node_market "https://github.com/richardawe/energytrm/blob/main/app/Services/MarketData/MarketDataIngestor.php"
click node_marketfeeds "https://github.com/richardawe/energytrm/blob/main/app/Services/MarketData/EiaService.php"
click node_feedcommands "https://github.com/richardawe/energytrm/blob/main/app/Console/Commands/FetchMarketPrices.php"
click node_fxcommands "https://github.com/richardawe/energytrm/blob/main/app/Console/Commands/FetchFxRates.php"
click node_dashboard "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/DashboardController.php"
click node_invoices "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Operations/InvoiceController.php"
click node_settlements "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Operations/SettlementController.php"
click node_shipments "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Operations/ShipmentController.php"
click node_checklists "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Operations/EobChecklistController.php"
click node_risk "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Risk/VarController.php"
click node_riskreports "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Risk/ReportsController.php"
click node_admin "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Admin/UserController.php"
click node_audit "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Admin/AuditLogController.php"
click node_training "https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Training/VideoController.php"
click node_models "https://github.com/richardawe/energytrm/blob/main/app/Models/Trade.php"
click node_store "https://github.com/richardawe/energytrm/blob/main/config/database.php"

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_routes,node_dashboard,node_user toneBlue
class node_masters,node_market,node_marketfeeds,node_feedcommands,node_fxcommands,node_store toneAmber
class node_trade,node_financial,node_models toneMint
class node_invoices,node_settlements,node_shipments,node_checklists,node_risk,node_riskreports toneRose
class node_admin,node_audit,node_training toneIndigo
```

## Components

### Web access

- [Web routes](https://github.com/richardawe/energytrm/blob/main/routes/web.php): `routes/web.php`
- [Dashboard](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/DashboardController.php): `app/Http/Controllers/DashboardController.php`

### Reference and market data

- [Master data](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Master/PipelineController.php): `app/Http/Controllers/Master/PipelineController.php`
- [Market data](https://github.com/richardawe/energytrm/blob/main/app/Services/MarketData/MarketDataIngestor.php): `app/Services/MarketData/MarketDataIngestor.php`
- [Market feed services](https://github.com/richardawe/energytrm/blob/main/app/Services/MarketData/EiaService.php): `app/Services/MarketData/EiaService.php`
- [Feed commands](https://github.com/richardawe/energytrm/blob/main/app/Console/Commands/FetchMarketPrices.php): `app/Console/Commands/FetchMarketPrices.php`
- [FX command](https://github.com/richardawe/energytrm/blob/main/app/Console/Commands/FetchFxRates.php): `app/Console/Commands/FetchFxRates.php`

### Trading and finance

- [Physical trades](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Trades/TradeController.php): `app/Http/Controllers/Trades/TradeController.php`
- [Financial trades](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Financials/FinancialTradeController.php): `app/Http/Controllers/Financials/FinancialTradeController.php`
- [Domain models](https://github.com/richardawe/energytrm/blob/main/app/Models/Trade.php): `app/Models/Trade.php`

### Operations and risk

- [Invoices](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Operations/InvoiceController.php): `app/Http/Controllers/Operations/InvoiceController.php`
- [Settlements](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Operations/SettlementController.php): `app/Http/Controllers/Operations/SettlementController.php`
- [Shipments and nominations](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Operations/ShipmentController.php): `app/Http/Controllers/Operations/ShipmentController.php`
- [EOB checklists](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Operations/EobChecklistController.php): `app/Http/Controllers/Operations/EobChecklistController.php`
- [Risk analysis](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Risk/VarController.php): `app/Http/Controllers/Risk/VarController.php`
- [Exposure and reports](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Risk/ReportsController.php): `app/Http/Controllers/Risk/ReportsController.php`

### Administration and training

- [User administration](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Admin/UserController.php): `app/Http/Controllers/Admin/UserController.php`
- [Audit logs](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Admin/AuditLogController.php): `app/Http/Controllers/Admin/AuditLogController.php`
- [Training and quizzes](https://github.com/richardawe/energytrm/blob/main/app/Http/Controllers/Training/VideoController.php): `app/Http/Controllers/Training/VideoController.php`

### Other components

- **User**
- [Database](https://github.com/richardawe/energytrm/blob/main/config/database.php): `config/database.php`

## Connections

- User → Web routes: requests
- Web routes → Physical trades: dispatches
- Web routes → Financial trades: dispatches
- Web routes → Master data: dispatches
- Web routes → Dashboard: dispatches
- Web routes → Invoices: dispatches
- Web routes → Settlements: dispatches
- Web routes → Shipments and nominations: dispatches
- Web routes → EOB checklists: dispatches
- Web routes → Risk analysis: dispatches
- Web routes → Exposure and reports: dispatches
- Web routes → User administration: dispatches
- Web routes → Audit logs: dispatches
- Web routes → Training and quizzes: dispatches
- Physical trades → Domain models: reads and writes
- Financial trades → Domain models: reads and writes
- Master data → Domain models: reads and writes
- Dashboard → Domain models: reads
- Invoices → Domain models: reads and writes
- Settlements → Domain models: reads and writes
- Shipments and nominations → Domain models: reads and writes
- EOB checklists → Domain models: reads and writes
- Risk analysis → Domain models: reads
- Exposure and reports → Domain models: reads
- User administration → Domain models: reads and writes
- Audit logs → Domain models: reads
- Training and quizzes → Domain models: reads and writes
- Domain models → Database: persists via ORM
