# iamkk369/dice-roller-api architecture

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

- Interactive diagram: https://gitdiagram.com/iamkk369/dice-roller-api
- Repository: https://github.com/iamkk369/dice-roller-api

## Overview

Dice Roller API pairs a browser dashboard with a serverless roll endpoint. A user selects dice and quantity; the dashboard either requests the configured API or explicitly uses local simulation, then presents rolls with browser-calculated modifiers and statistics, history, and export. The documented deployed path runs through API Gateway to Lambda and returns JSON to the browser. The Lambda excerpt confirms parameter validation, cryptographic rolls, and response construction; dashboard internals and AWS wiring are described in the README rather than sampled source.

Main entry points: [`frontend/index.html`](https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html) (API request routing), [`template.yaml`](https://github.com/iamkk369/dice-roller-api/blob/main/template.yaml) (API Gateway), [`lambda/index.mjs`](https://github.com/iamkk369/dice-roller-api/blob/main/lambda/index.mjs) (Validate and roll)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Browser dashboard"]
  node_dashboard_page["Dashboard interface<br/>[index.html]"]
  node_roll_request["API request routing<br/>[index.html]"]
  node_local_sim["Local simulation<br/>[index.html]"]
  node_stats["Roll statistics<br/>[index.html]"]
  node_history_export["History and CSV<br/>[index.html]"]
end

subgraph group_api["Roll API"]
  node_lambda_roll["Validate and roll<br/>[index.mjs]"]
end

subgraph group_hosting["AWS hosting"]
  node_api_gateway{{"API Gateway<br/>[template.yaml]"}}
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_dashboard_page
node_dashboard_page -->|"selects mode"| node_roll_request
node_roll_request -->|"requests roll"| node_api_gateway
node_roll_request -.->|"simulates roll"| node_local_sim
node_api_gateway -->|"routes request"| node_lambda_roll
node_lambda_roll -->|"returns JSON"| node_api_gateway
node_api_gateway -->|"returns response"| node_roll_request
node_roll_request -->|"calculates metrics"| node_stats
node_roll_request -->|"records and exports"| node_history_export
node_stats -->|"displays results"| node_dashboard_page
node_history_export -->|"displays history"| node_dashboard_page

click node_dashboard_page "https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html"
click node_roll_request "https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html"
click node_local_sim "https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html"
click node_stats "https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html"
click node_history_export "https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html"
click node_api_gateway "https://github.com/iamkk369/dice-roller-api/blob/main/template.yaml"
click node_lambda_roll "https://github.com/iamkk369/dice-roller-api/blob/main/lambda/index.mjs"

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_dashboard_page,node_roll_request,node_local_sim,node_stats,node_history_export,node_user toneBlue
class node_lambda_roll toneAmber
class node_api_gateway toneMint
```

## Components

### Browser dashboard

- [Dashboard interface](https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html): `frontend/index.html`
- [API request routing](https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html): `frontend/index.html`
- [Local simulation](https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html): `frontend/index.html`
- [Roll statistics](https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html): `frontend/index.html`
- [History and CSV](https://github.com/iamkk369/dice-roller-api/blob/main/frontend/index.html): `frontend/index.html`

### Roll API

- [Validate and roll](https://github.com/iamkk369/dice-roller-api/blob/main/lambda/index.mjs): `lambda/index.mjs`

### AWS hosting

- [API Gateway](https://github.com/iamkk369/dice-roller-api/blob/main/template.yaml): `template.yaml`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard interface: uses (evidence: `README.md`)
- Dashboard interface → API request routing: selects mode (evidence: `README.md`)
- API request routing → API Gateway: requests roll (evidence: `README.md`)
- API request routing → Local simulation: simulates roll (evidence: `README.md`)
- API Gateway → Validate and roll: routes request (evidence: `README.md`)
- Validate and roll → API Gateway: returns JSON (evidence: `README.md`)
- API Gateway → API request routing: returns response (evidence: `README.md`)
- API request routing → Roll statistics: calculates metrics (evidence: `README.md`)
- API request routing → History and CSV: records and exports (evidence: `README.md`)
- Roll statistics → Dashboard interface: displays results (evidence: `README.md`)
- History and CSV → Dashboard interface: displays history (evidence: `README.md`)
