# devabm/aws-service-detective architecture

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

- Interactive diagram: https://gitdiagram.com/devabm/aws-service-detective
- Repository: https://github.com/devabm/aws-service-detective

## Overview

AWS Service Detective is a browser-based AWS-service guessing game, with daily mysteries generated by a scheduled Lambda. Players use progressively revealing clues to identify a service and earn points; the documented app also supports difficulty levels, adaptive mystery difficulty, and a leaderboard. The graph includes the browser game, mystery-generation workflow, result recording, and score APIs. The HTML and deployment wiring were not excerpted, so browser-to-backend links are shown only where documented or marked unverified.

Main entry points: [`lambda_function.py`](https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py) (Mystery Generator), [`aws-service-detective.html`](https://github.com/devabm/aws-service-detective/blob/main/aws-service-detective.html) (Game Interface), [`scoreboard.py`](https://github.com/devabm/aws-service-detective/blob/main/scoreboard.py) (Score and Leaderboard API), [`record_result.py`](https://github.com/devabm/aws-service-detective/blob/main/record_result.py) (Result Recorder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Detective Game"]
  node_browser["Game Interface"]
  node_gameplay["Clue Gameplay"]
end

subgraph group_mystery["Mystery Agent"]
  node_scheduler(("Daily Scheduler"))
  node_agent["Mystery Generator<br/>[lambda_function.py]"]
  node_selection["Service Selection<br/>[lambda_function.py]"]
  node_cluegen["Clue Generation<br/>[lambda_function.py]"]
  node_validation["Clue Validation<br/>[lambda_function.py]"]
  node_adaptive["Difficulty Adaptation<br/>[lambda_function.py]"]
end

subgraph group_results["Results and Scoring"]
  node_resultapi["Result Recorder<br/>[record_result.py]"]
  node_scoreapi["Score and Leaderboard API<br/>[scoreboard.py]"]
end

subgraph group_aws["AWS Services"]
  node_challenge[("Challenge Data")]
  node_history[("Challenge History")]
  node_performance[("Performance Data")]
  node_scores[("Score Table")]
  node_bedrock["Amazon Bedrock"]
  node_s3[("Amazon S3")]
  node_dynamodb[("Amazon DynamoDB")]
end

node_player(("Player"))

node_player -.->|"plays"| node_browser
node_browser -.->|"presents clues"| node_gameplay
node_scheduler -.->|"triggers"| node_agent
node_agent -->|"loads and saves"| node_history
node_agent -->|"loads"| node_performance
node_agent -->|"chooses tier"| node_adaptive
node_agent -->|"chooses service"| node_selection
node_agent -->|"requests clues"| node_cluegen
node_cluegen -->|"invokes model"| node_bedrock
node_agent -->|"validates clues"| node_validation
node_agent -->|"saves challenge"| node_challenge
node_agent -->|"reads and writes"| node_s3
node_browser -.->|"posts outcome"| node_resultapi
node_resultapi -->|"reads and writes"| node_performance
node_browser -.->|"submits score"| node_scoreapi
node_scoreapi -->|"reads and writes"| node_scores
node_scoreapi -->|"queries table"| node_dynamodb

click node_browser "https://github.com/devabm/aws-service-detective/blob/main/aws-service-detective.html"
click node_gameplay "https://github.com/devabm/aws-service-detective/blob/main/aws-service-detective.html"
click node_agent "https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py"
click node_selection "https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py"
click node_cluegen "https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py"
click node_validation "https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py"
click node_resultapi "https://github.com/devabm/aws-service-detective/blob/main/record_result.py"
click node_adaptive "https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py"
click node_scoreapi "https://github.com/devabm/aws-service-detective/blob/main/scoreboard.py"

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_browser,node_gameplay toneBlue
class node_scheduler,node_agent,node_selection,node_cluegen,node_validation,node_adaptive toneAmber
class node_resultapi,node_scoreapi toneMint
class node_challenge,node_history,node_performance,node_scores,node_bedrock,node_s3,node_dynamodb toneRose
class node_player toneIndigo
```

## Components

### Detective Game

- [Game Interface](https://github.com/devabm/aws-service-detective/blob/main/aws-service-detective.html): `aws-service-detective.html`
- [Clue Gameplay](https://github.com/devabm/aws-service-detective/blob/main/aws-service-detective.html): `aws-service-detective.html`

### Mystery Agent

- **Daily Scheduler**
- [Mystery Generator](https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py): `lambda_function.py`
- [Service Selection](https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py): `lambda_function.py`
- [Clue Generation](https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py): `lambda_function.py`
- [Clue Validation](https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py): `lambda_function.py`
- [Difficulty Adaptation](https://github.com/devabm/aws-service-detective/blob/main/lambda_function.py): `lambda_function.py`

### Results and Scoring

- [Result Recorder](https://github.com/devabm/aws-service-detective/blob/main/record_result.py): `record_result.py`
- [Score and Leaderboard API](https://github.com/devabm/aws-service-detective/blob/main/scoreboard.py): `scoreboard.py`

### AWS Services

- **Challenge Data**
- **Challenge History**
- **Performance Data**
- **Score Table**
- **Amazon Bedrock**
- **Amazon S3**
- **Amazon DynamoDB**

### Other components

- **Player**

## Connections

- Player → Game Interface: plays (evidence: `README.md`)
- Game Interface → Clue Gameplay: presents clues (evidence: `README.md`)
- Daily Scheduler → Mystery Generator: triggers (evidence: `lambda_function.py`)
- Mystery Generator → Challenge History: loads and saves (evidence: `lambda_function.py`)
- Mystery Generator → Performance Data: loads (evidence: `lambda_function.py`)
- Mystery Generator → Difficulty Adaptation: chooses tier (evidence: `lambda_function.py`)
- Mystery Generator → Service Selection: chooses service (evidence: `lambda_function.py`)
- Mystery Generator → Clue Generation: requests clues (evidence: `lambda_function.py`)
- Clue Generation → Amazon Bedrock: invokes model (evidence: `lambda_function.py`)
- Mystery Generator → Clue Validation: validates clues (evidence: `lambda_function.py`)
- Mystery Generator → Challenge Data: saves challenge (evidence: `lambda_function.py`)
- Mystery Generator → Amazon S3: reads and writes (evidence: `lambda_function.py`)
- Game Interface → Result Recorder: posts outcome (evidence: `record_result.py`)
- Result Recorder → Performance Data: reads and writes (evidence: `record_result.py`)
- Game Interface → Score and Leaderboard API: submits score (evidence: `scoreboard.py`)
- Score and Leaderboard API → Score Table: reads and writes (evidence: `scoreboard.py`)
- Score and Leaderboard API → Amazon DynamoDB: queries table (evidence: `scoreboard.py`)
