# steph-vie/prompt_manager architecture

> Architecture diagram of the GitHub repository steph-vie/prompt_manager, 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/steph-vie/prompt_manager
- Repository: https://github.com/steph-vie/prompt_manager

## Overview

Prompt Manager is a Flask application for organizing image-generation prompts and their source images. Users browse, search, filter, create, edit, and delete prompts; uploads are parsed for generation metadata and associated with categories and tags. The application also provides category management, statistics, JSON backup and restore, and image/hash maintenance. The main request and startup flows are visible in the excerpts; template behavior and some route details are only documented or referenced, so those links are limited to the available evidence.

Main entry points: [`routes/prompt_routes.py`](https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py) (Prompt routes), [`app.py`](https://github.com/steph-vie/prompt_manager/blob/main/app.py) (Flask app), [`maintenance.py`](https://github.com/steph-vie/prompt_manager/blob/main/maintenance.py) (Image conversion and hashes), [`models.py`](https://github.com/steph-vie/prompt_manager/blob/main/models.py) (Prompt and category models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Flask app<br/>[app.py]"]
  node_routes["Prompt routes<br/>[prompt_routes.py]"]
  node_ui["Web templates"]
  node_config["App configuration<br/>[config.py]"]
end

subgraph group_domain["Prompt domain"]
  node_prompts["Prompt management<br/>[prompt_routes.py]"]
  node_categories["Category management<br/>[prompt_routes.py]"]
  node_search["Browse and statistics<br/>[prompt_routes.py]"]
  node_metadata["Image metadata extraction<br/>[utils.py]"]
end

subgraph group_operations["Data operations"]
  node_models["Prompt and category models<br/>[models.py]"]
  node_database[("SQLite database")]
  node_backup["JSON backup and restore<br/>[backup.py]"]
end

subgraph group_maintenance["Image maintenance"]
  node_imagefiles[("Uploaded images<br/>[config.py]")]
  node_maintenance["Image conversion and hashes<br/>[maintenance.py]"]
  node_imageutils["Image and hash utilities<br/>[utils.py]"]
end

node_user(("Web user"))
node_cli(("CLI operator"))

node_user -->|"uses"| node_routes
node_routes -->|"renders"| node_ui
node_app -->|"loads"| node_config
node_app -->|"registers"| node_routes
node_routes -->|"handles"| node_prompts
node_routes -->|"manages"| node_categories
node_routes -->|"filters"| node_search
node_routes -->|"extracts"| node_metadata
node_routes -->|"queries and saves"| node_models
node_models -.->|"persists"| node_database
node_routes -.->|"stores uploads"| node_imagefiles
node_app -->|"registers commands"| node_backup
node_cli -->|"runs commands"| node_app
node_backup -->|"reads and restores"| node_models
node_app -->|"runs at startup"| node_maintenance
node_maintenance -->|"updates records"| node_models
node_maintenance -->|"converts and hashes"| node_imageutils
node_maintenance -->|"processes files"| node_imagefiles

click node_app "https://github.com/steph-vie/prompt_manager/blob/main/app.py"
click node_routes "https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py"
click node_ui "https://github.com/steph-vie/prompt_manager/tree/main/templates"
click node_config "https://github.com/steph-vie/prompt_manager/blob/main/config.py"
click node_prompts "https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py"
click node_categories "https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py"
click node_search "https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py"
click node_metadata "https://github.com/steph-vie/prompt_manager/blob/main/utils.py"
click node_models "https://github.com/steph-vie/prompt_manager/blob/main/models.py"
click node_backup "https://github.com/steph-vie/prompt_manager/blob/main/backup.py"
click node_imagefiles "https://github.com/steph-vie/prompt_manager/blob/main/config.py"
click node_maintenance "https://github.com/steph-vie/prompt_manager/blob/main/maintenance.py"
click node_imageutils "https://github.com/steph-vie/prompt_manager/blob/main/utils.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_app,node_routes,node_ui,node_config,node_user toneBlue
class node_prompts,node_categories,node_search,node_metadata toneAmber
class node_models,node_database,node_backup toneMint
class node_imagefiles,node_maintenance,node_imageutils toneRose
class node_cli toneIndigo
```

## Components

### Web application

- [Flask app](https://github.com/steph-vie/prompt_manager/blob/main/app.py): `app.py`
- [Prompt routes](https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py): `routes/prompt_routes.py`
- [Web templates](https://github.com/steph-vie/prompt_manager/tree/main/templates): `templates`
- [App configuration](https://github.com/steph-vie/prompt_manager/blob/main/config.py): `config.py`

### Prompt domain

- [Prompt management](https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py): `routes/prompt_routes.py`
- [Category management](https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py): `routes/prompt_routes.py`
- [Browse and statistics](https://github.com/steph-vie/prompt_manager/blob/main/routes/prompt_routes.py): `routes/prompt_routes.py`
- [Image metadata extraction](https://github.com/steph-vie/prompt_manager/blob/main/utils.py): `utils.py`

### Data operations

- [Prompt and category models](https://github.com/steph-vie/prompt_manager/blob/main/models.py): `models.py`
- **SQLite database**
- [JSON backup and restore](https://github.com/steph-vie/prompt_manager/blob/main/backup.py): `backup.py`

### Image maintenance

- [Uploaded images](https://github.com/steph-vie/prompt_manager/blob/main/config.py): `config.py`
- [Image conversion and hashes](https://github.com/steph-vie/prompt_manager/blob/main/maintenance.py): `maintenance.py`
- [Image and hash utilities](https://github.com/steph-vie/prompt_manager/blob/main/utils.py): `utils.py`

### Other components

- **Web user**
- **CLI operator**

## Connections

- Web user → Prompt routes: uses (evidence: `README.md`)
- Prompt routes → Web templates: renders (evidence: `routes/prompt_routes.py`)
- Flask app → App configuration: loads (evidence: `app.py`)
- Flask app → Prompt routes: registers (evidence: `app.py`)
- Prompt routes → Prompt management: handles (evidence: `routes/prompt_routes.py`)
- Prompt routes → Category management: manages (evidence: `routes/prompt_routes.py`)
- Prompt routes → Browse and statistics: filters (evidence: `routes/prompt_routes.py`)
- Prompt routes → Image metadata extraction: extracts (evidence: `routes/prompt_routes.py`)
- Prompt routes → Prompt and category models: queries and saves (evidence: `routes/prompt_routes.py`)
- Prompt and category models → SQLite database: persists
- Prompt routes → Uploaded images: stores uploads
- Flask app → JSON backup and restore: registers commands (evidence: `app.py`)
- CLI operator → Flask app: runs commands (evidence: `README.md`)
- JSON backup and restore → Prompt and category models: reads and restores (evidence: `backup.py`)
- Flask app → Image conversion and hashes: runs at startup (evidence: `app.py`)
- Image conversion and hashes → Prompt and category models: updates records (evidence: `maintenance.py`)
- Image conversion and hashes → Image and hash utilities: converts and hashes (evidence: `maintenance.py`)
- Image conversion and hashes → Uploaded images: processes files (evidence: `maintenance.py`)
