# devanshk01/ssd-simulator architecture

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

- Interactive diagram: https://gitdiagram.com/devanshk01/ssd-simulator
- Repository: https://github.com/devanshk01/ssd-simulator

## Overview

SSD Simulator models NAND storage behavior and exposes it through CLI modes and a real-time web dashboard. Users configure the device, then issue read, write, and TRIM operations or run workloads; the controller translates logical requests into flash activity, with garbage collection, wear leveling, and bad-block handling maintaining the simulated device. Statistics and state feed console and dashboard views. The README documents capabilities beyond the sampled excerpts; relationships for those are cited to it rather than presented as source-verified call paths.

Main entry points: [`src/ssd.c`](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd.c) (SSD Controller), [`src/ssd_server.c`](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_server.c) (HTTP & REST API), [`src/main.c`](https://github.com/devanshk01/ssd-simulator/blob/main/src/main.c) (CLI & Workloads), [`web/index.html`](https://github.com/devanshk01/ssd-simulator/blob/main/web/index.html) (Dashboard Layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Simulation Runtime"]
  node_config["Configuration<br/>[ssd_config.c]"]
  node_controller["SSD Controller<br/>[ssd.c]"]
  node_ftl["Address Translation<br/>[ssd_ftl.c]"]
  node_nand["NAND Model<br/>[ssd_nand.c]"]
end

subgraph group_maintenance["Flash Maintenance"]
  node_gc["Garbage Collection<br/>[ssd_gc.c]"]
  node_wear["Wear Leveling<br/>[ssd_wear.c]"]
  node_badblocks["Bad Block Management<br/>[ssd_block.c]"]
end

subgraph group_interfaces["User Interfaces"]
  node_cli["CLI &amp; Workloads<br/>[main.c]"]
  node_http["HTTP &amp; REST API<br/>[ssd_server.c]"]
  node_dashboard["Dashboard Client<br/>[app.js]"]
  node_dashboardpage["Dashboard Layout<br/>[index.html]"]
  node_dashboardstyle["Dashboard Styling<br/>[style.css]"]
end

subgraph group_insights["Analytics"]
  node_stats["Metrics &amp; State Export<br/>[ssd_stats.c]"]
end

node_user(("User"))
node_browser(("Web Browser"))

node_user -->|"issues commands"| node_cli
node_cli -->|"loads settings"| node_config
node_cli -->|"runs operations"| node_controller
node_cli -->|"starts dashboard server"| node_http
node_controller -->|"translates addresses"| node_ftl
node_controller -->|"performs flash I/O"| node_nand
node_controller -->|"checks GC triggers"| node_gc
node_controller -->|"checks wear leveling"| node_wear
node_controller -->|"manages worn blocks"| node_badblocks
node_controller -.->|"records operations"| node_stats
node_http -->|"dispatches commands"| node_controller
node_http -->|"exports metrics and state"| node_stats
node_http -->|"serves static files"| node_dashboardpage
node_browser -->|"uses dashboard"| node_dashboard
node_dashboard -->|"calls REST API"| node_http
node_dashboardpage -.->|"hosts client interface"| node_dashboard
node_dashboardpage -.->|"uses stylesheet"| node_dashboardstyle

click node_config "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_config.c"
click node_cli "https://github.com/devanshk01/ssd-simulator/blob/main/src/main.c"
click node_controller "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd.c"
click node_ftl "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_ftl.c"
click node_nand "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_nand.c"
click node_gc "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_gc.c"
click node_wear "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_wear.c"
click node_badblocks "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_block.c"
click node_stats "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_stats.c"
click node_http "https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_server.c"
click node_dashboard "https://github.com/devanshk01/ssd-simulator/blob/main/web/app.js"
click node_dashboardpage "https://github.com/devanshk01/ssd-simulator/blob/main/web/index.html"
click node_dashboardstyle "https://github.com/devanshk01/ssd-simulator/blob/main/web/style.css"

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_config,node_controller,node_ftl,node_nand,node_user,node_browser toneBlue
class node_gc,node_wear,node_badblocks toneAmber
class node_cli,node_http,node_dashboard,node_dashboardpage,node_dashboardstyle toneMint
class node_stats toneRose
```

## Components

### Simulation Runtime

- [Configuration](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_config.c): `src/ssd_config.c`
- [SSD Controller](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd.c): `src/ssd.c`
- [Address Translation](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_ftl.c): `src/ssd_ftl.c`
- [NAND Model](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_nand.c): `src/ssd_nand.c`

### Flash Maintenance

- [Garbage Collection](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_gc.c): `src/ssd_gc.c`
- [Wear Leveling](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_wear.c): `src/ssd_wear.c`
- [Bad Block Management](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_block.c): `src/ssd_block.c`

### User Interfaces

- [CLI & Workloads](https://github.com/devanshk01/ssd-simulator/blob/main/src/main.c): `src/main.c`
- [HTTP & REST API](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_server.c): `src/ssd_server.c`
- [Dashboard Client](https://github.com/devanshk01/ssd-simulator/blob/main/web/app.js): `web/app.js`
- [Dashboard Layout](https://github.com/devanshk01/ssd-simulator/blob/main/web/index.html): `web/index.html`
- [Dashboard Styling](https://github.com/devanshk01/ssd-simulator/blob/main/web/style.css): `web/style.css`

### Analytics

- [Metrics & State Export](https://github.com/devanshk01/ssd-simulator/blob/main/src/ssd_stats.c): `src/ssd_stats.c`

### Other components

- **User**
- **Web Browser**

## Connections

- User → CLI & Workloads: issues commands (evidence: `README.md`)
- CLI & Workloads → Configuration: loads settings (evidence: `README.md`)
- CLI & Workloads → SSD Controller: runs operations (evidence: `README.md`)
- CLI & Workloads → HTTP & REST API: starts dashboard server (evidence: `README.md`)
- SSD Controller → Address Translation: translates addresses
- SSD Controller → NAND Model: performs flash I/O
- SSD Controller → Garbage Collection: checks GC triggers
- SSD Controller → Wear Leveling: checks wear leveling
- SSD Controller → Bad Block Management: manages worn blocks
- SSD Controller → Metrics & State Export: records operations
- HTTP & REST API → SSD Controller: dispatches commands (evidence: `src/ssd_server.c`)
- HTTP & REST API → Metrics & State Export: exports metrics and state (evidence: `src/ssd_server.c`)
- HTTP & REST API → Dashboard Layout: serves static files (evidence: `README.md`)
- Web Browser → Dashboard Client: uses dashboard (evidence: `README.md`)
- Dashboard Client → HTTP & REST API: calls REST API (evidence: `README.md`)
- Dashboard Layout → Dashboard Client: hosts client interface
- Dashboard Layout → Dashboard Styling: uses stylesheet
