# lilglo254/flask_contact_book architecture

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

- Interactive diagram: https://gitdiagram.com/lilglo254/flask_contact_book
- Repository: https://github.com/lilglo254/flask_contact_book

## Overview

This is a Flask contact book with account registration, login/logout, contact creation, and password recovery. Users submit requests to route handlers in app.py; those handlers render pages or read and update MySQL records. The workflow is implemented in a small monolith, so several domain responsibilities share app.py. Source excerpts show route-to-template rendering and database calls; template internals were not sampled.

Main entry points: [`app.py`](https://github.com/lilglo254/flask_contact_book/blob/main/app.py) (Password recovery), [`database.py`](https://github.com/lilglo254/flask_contact_book/blob/main/database.py) (Connection helper), [`templates/index.html`](https://github.com/lilglo254/flask_contact_book/blob/main/templates/index.html) (Home page), [`templates/add_contact.html`](https://github.com/lilglo254/flask_contact_book/blob/main/templates/add_contact.html) (Add contact page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web routes"]
  node_home["Home route<br/>[app.py]"]
  node_contacts["Contact creation<br/>[app.py]"]
  node_signup["Registration<br/>[app.py]"]
  node_login["Login<br/>[app.py]"]
  node_recovery["Password recovery<br/>[app.py]"]
  node_logout["Logout<br/>[app.py]"]
end

subgraph group_pages["User pages"]
  node_indexpage["Home page<br/>[index.html]"]
  node_contactpage["Add contact page<br/>[add_contact.html]"]
  node_signuppage["Sign-up page<br/>[sign_up.html]"]
  node_loginpage["Login page<br/>[login.html]"]
  node_forgotpage["Forgot-password page"]
  node_resetpage["Reset-password page"]
end

subgraph group_storage["Database access"]
  node_connector["Connection helper<br/>[database.py]"]
  node_mysql[("MySQL database")]
end

node_user(("User"))

node_user -->|"requests"| node_home
node_user -->|"submits contact"| node_contacts
node_user -->|"submits registration"| node_signup
node_user -->|"submits credentials"| node_login
node_user -->|"requests reset"| node_recovery
node_user -->|"requests logout"| node_logout
node_home -->|"renders"| node_indexpage
node_contacts -->|"renders"| node_contactpage
node_signup -->|"renders"| node_signuppage
node_login -->|"renders"| node_loginpage
node_recovery -->|"renders"| node_forgotpage
node_recovery -->|"renders"| node_resetpage
node_contacts -->|"opens connection"| node_connector
node_signup -->|"opens connection"| node_connector
node_login -->|"opens connection"| node_connector
node_recovery -->|"opens connection"| node_connector
node_connector -->|"connects"| node_mysql
node_contacts -->|"writes contact"| node_mysql
node_signup -->|"creates account"| node_mysql
node_login -->|"reads account"| node_mysql
node_recovery -->|"updates credentials"| node_mysql

click node_home "https://github.com/lilglo254/flask_contact_book/blob/main/app.py"
click node_contacts "https://github.com/lilglo254/flask_contact_book/blob/main/app.py"
click node_signup "https://github.com/lilglo254/flask_contact_book/blob/main/app.py"
click node_login "https://github.com/lilglo254/flask_contact_book/blob/main/app.py"
click node_recovery "https://github.com/lilglo254/flask_contact_book/blob/main/app.py"
click node_logout "https://github.com/lilglo254/flask_contact_book/blob/main/app.py"
click node_indexpage "https://github.com/lilglo254/flask_contact_book/blob/main/templates/index.html"
click node_contactpage "https://github.com/lilglo254/flask_contact_book/blob/main/templates/add_contact.html"
click node_signuppage "https://github.com/lilglo254/flask_contact_book/blob/main/templates/sign_up.html"
click node_loginpage "https://github.com/lilglo254/flask_contact_book/blob/main/templates/login.html"
click node_forgotpage "https://github.com/lilglo254/flask_contact_book/blob/main/templates/forgot_password.html"
click node_resetpage "https://github.com/lilglo254/flask_contact_book/blob/main/templates/reset_password.html"
click node_connector "https://github.com/lilglo254/flask_contact_book/blob/main/database.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_home,node_contacts,node_signup,node_login,node_recovery,node_logout,node_user toneBlue
class node_indexpage,node_contactpage,node_signuppage,node_loginpage,node_forgotpage,node_resetpage toneAmber
class node_connector,node_mysql toneMint
```

## Components

### Web routes

- [Home route](https://github.com/lilglo254/flask_contact_book/blob/main/app.py): `app.py`
- [Contact creation](https://github.com/lilglo254/flask_contact_book/blob/main/app.py): `app.py`
- [Registration](https://github.com/lilglo254/flask_contact_book/blob/main/app.py): `app.py`
- [Login](https://github.com/lilglo254/flask_contact_book/blob/main/app.py): `app.py`
- [Password recovery](https://github.com/lilglo254/flask_contact_book/blob/main/app.py): `app.py`
- [Logout](https://github.com/lilglo254/flask_contact_book/blob/main/app.py): `app.py`

### User pages

- [Home page](https://github.com/lilglo254/flask_contact_book/blob/main/templates/index.html): `templates/index.html`
- [Add contact page](https://github.com/lilglo254/flask_contact_book/blob/main/templates/add_contact.html): `templates/add_contact.html`
- [Sign-up page](https://github.com/lilglo254/flask_contact_book/blob/main/templates/sign_up.html): `templates/sign_up.html`
- [Login page](https://github.com/lilglo254/flask_contact_book/blob/main/templates/login.html): `templates/login.html`
- [Forgot-password page](https://github.com/lilglo254/flask_contact_book/blob/main/templates/forgot_password.html): `templates/forgot_password.html`
- [Reset-password page](https://github.com/lilglo254/flask_contact_book/blob/main/templates/reset_password.html): `templates/reset_password.html`

### Database access

- [Connection helper](https://github.com/lilglo254/flask_contact_book/blob/main/database.py): `database.py`
- **MySQL database**

### Other components

- **User**

## Connections

- User → Home route: requests (evidence: `app.py`)
- User → Contact creation: submits contact (evidence: `app.py`)
- User → Registration: submits registration (evidence: `app.py`)
- User → Login: submits credentials (evidence: `app.py`)
- User → Password recovery: requests reset (evidence: `app.py`)
- User → Logout: requests logout (evidence: `app.py`)
- Home route → Home page: renders (evidence: `app.py`)
- Contact creation → Add contact page: renders (evidence: `app.py`)
- Registration → Sign-up page: renders (evidence: `app.py`)
- Login → Login page: renders (evidence: `app.py`)
- Password recovery → Forgot-password page: renders (evidence: `app.py`)
- Password recovery → Reset-password page: renders (evidence: `app.py`)
- Contact creation → Connection helper: opens connection (evidence: `app.py`)
- Registration → Connection helper: opens connection (evidence: `app.py`)
- Login → Connection helper: opens connection (evidence: `app.py`)
- Password recovery → Connection helper: opens connection (evidence: `app.py`)
- Connection helper → MySQL database: connects (evidence: `database.py`)
- Contact creation → MySQL database: writes contact (evidence: `app.py`)
- Registration → MySQL database: creates account (evidence: `app.py`)
- Login → MySQL database: reads account (evidence: `app.py`)
- Password recovery → MySQL database: updates credentials (evidence: `app.py`)
