# candyhuang940730/moneymoney architecture

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

- Interactive diagram: https://gitdiagram.com/candyhuang940730/moneymoney
- Repository: https://github.com/candyhuang940730/moneymoney

## Overview

Hydra Underground is a self-deployed educational CTF website. Visitors enter through a portal and can open either the five-chapter investigation center or the underground site. The site presents a login page; its routes verify users and manage session state through a SQLite-backed database. The story briefing can open on first entry and be reopened from the page. The README describes forgot-password and other future CTF functions, but they are not implemented in the sampled runtime; template wiring for the briefing script was not shown.

Main entry points: [`app/website/routes.py`](https://github.com/candyhuang940730/moneymoney/blob/main/app/website/routes.py) (Site Routes), [`app/website/database.py`](https://github.com/candyhuang940730/moneymoney/blob/main/app/website/database.py) (User Database), [`app/__init__.py`](https://github.com/candyhuang940730/moneymoney/blob/main/app/__init__.py) (App Factory), [`app/ctf_center/routes.py`](https://github.com/candyhuang940730/moneymoney/blob/main/app/ctf_center/routes.py) (Center Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["Navigation"]
  node_app_factory["App Factory<br/>[__init__.py]"]
  node_portal["Portal Page<br/>[portal.html]"]
end

subgraph group_investigation["Investigation Center"]
  node_ctf_routes["Center Routes<br/>[routes.py]"]
  node_chapter_briefing["Five Chapters<br/>[index.html]"]
end

subgraph group_website["Underground Website"]
  node_site_routes["Site Routes<br/>[routes.py]"]
  node_login_page["Login Page<br/>[login.html]"]
  node_story_script["Briefing Dialog Logic<br/>[story_intro.js]"]
  node_base_template["Base Layout<br/>[base.html]"]
end

subgraph group_persistence["User Persistence"]
  node_database["User Database<br/>[database.py]"]
  node_schema["Database Schema<br/>[schema.sql]"]
  node_sqlite[("SQLite Store")]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_portal
node_app_factory -->|"renders"| node_portal
node_app_factory -->|"registers"| node_ctf_routes
node_app_factory -->|"registers"| node_site_routes
node_visitor -->|"visits"| node_chapter_briefing
node_ctf_routes -->|"renders"| node_chapter_briefing
node_visitor -->|"visits"| node_login_page
node_site_routes -->|"renders"| node_login_page
node_site_routes -->|"verifies users"| node_database
node_site_routes -->|"loads session user"| node_database
node_database -->|"executes schema"| node_schema
node_database -->|"queries and writes"| node_sqlite

click node_app_factory "https://github.com/candyhuang940730/moneymoney/blob/main/app/__init__.py"
click node_portal "https://github.com/candyhuang940730/moneymoney/blob/main/app/templates/portal.html"
click node_ctf_routes "https://github.com/candyhuang940730/moneymoney/blob/main/app/ctf_center/routes.py"
click node_chapter_briefing "https://github.com/candyhuang940730/moneymoney/blob/main/app/templates/ctf_center/index.html"
click node_site_routes "https://github.com/candyhuang940730/moneymoney/blob/main/app/website/routes.py"
click node_login_page "https://github.com/candyhuang940730/moneymoney/blob/main/app/templates/website/login.html"
click node_story_script "https://github.com/candyhuang940730/moneymoney/blob/main/app/static/js/story_intro.js"
click node_base_template "https://github.com/candyhuang940730/moneymoney/blob/main/app/templates/base.html"
click node_database "https://github.com/candyhuang940730/moneymoney/blob/main/app/website/database.py"
click node_schema "https://github.com/candyhuang940730/moneymoney/blob/main/app/website/schema.sql"

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_app_factory,node_portal toneBlue
class node_ctf_routes,node_chapter_briefing toneAmber
class node_site_routes,node_login_page,node_story_script,node_base_template toneMint
class node_database,node_schema,node_sqlite toneRose
class node_visitor toneIndigo
```

## Components

### Navigation

- [App Factory](https://github.com/candyhuang940730/moneymoney/blob/main/app/__init__.py): `app/__init__.py`
- [Portal Page](https://github.com/candyhuang940730/moneymoney/blob/main/app/templates/portal.html): `app/templates/portal.html`

### Investigation Center

- [Center Routes](https://github.com/candyhuang940730/moneymoney/blob/main/app/ctf_center/routes.py): `app/ctf_center/routes.py`
- [Five Chapters](https://github.com/candyhuang940730/moneymoney/blob/main/app/templates/ctf_center/index.html): `app/templates/ctf_center/index.html`

### Underground Website

- [Site Routes](https://github.com/candyhuang940730/moneymoney/blob/main/app/website/routes.py): `app/website/routes.py`
- [Login Page](https://github.com/candyhuang940730/moneymoney/blob/main/app/templates/website/login.html): `app/templates/website/login.html`
- [Briefing Dialog Logic](https://github.com/candyhuang940730/moneymoney/blob/main/app/static/js/story_intro.js): `app/static/js/story_intro.js`
- [Base Layout](https://github.com/candyhuang940730/moneymoney/blob/main/app/templates/base.html): `app/templates/base.html`

### User Persistence

- [User Database](https://github.com/candyhuang940730/moneymoney/blob/main/app/website/database.py): `app/website/database.py`
- [Database Schema](https://github.com/candyhuang940730/moneymoney/blob/main/app/website/schema.sql): `app/website/schema.sql`
- **SQLite Store**

### Other components

- **Visitor**

## Connections

- Visitor → Portal Page: opens (evidence: `README.md`)
- App Factory → Portal Page: renders (evidence: `app/__init__.py`)
- App Factory → Center Routes: registers (evidence: `app/__init__.py`)
- App Factory → Site Routes: registers (evidence: `app/__init__.py`)
- Visitor → Five Chapters: visits (evidence: `README.md`)
- Center Routes → Five Chapters: renders (evidence: `app/ctf_center/routes.py`)
- Visitor → Login Page: visits (evidence: `README.md`)
- Site Routes → Login Page: renders (evidence: `app/website/routes.py`)
- Site Routes → User Database: verifies users (evidence: `app/website/routes.py`)
- Site Routes → User Database: loads session user (evidence: `app/website/routes.py`)
- User Database → Database Schema: executes schema (evidence: `app/website/database.py`)
- User Database → SQLite Store: queries and writes (evidence: `app/website/database.py`)
