# gspagare/contact_management_system architecture

> Architecture diagram of the GitHub repository gspagare/contact_management_system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gspagare/contact_management_system
- Repository: https://github.com/gspagare/contact_management_system

## Overview

##### Project type and purpose
- This is a full-stack web application (“Contact Management System”) built with Flask.
- Purpose: Allow public users to submit contact details via a form and let administrators log in to view/manage those submissions.

##### File structure
- Top-level Python modules:
– app.py: application entrypoint, route definitions
– config.py: configuration (DB URI, secret keys)
– extensions.py: Flask extensions instantiation (SQLAlchemy, LoginManager, WTF)
– forms.py: WTForms classes for ContactForm and AdminLoginForm
– models.py: SQLAlchemy models (Contact, AdminUser)
- Templates folder: HTML views, using Jinja2 for base.html, home, contact form, admin login/dashboard, manage admins
- Static folder: CSS (style.css) and JS (script.js) for client-side styling and tiny interactions
- requirements.txt: pinned Python dependencies
- README.md: high-level architecture and install/run instructions

##### README for additional insights
- SQLite is the persistent store.
- Flask-Login secures the /admin routes.
- Flask-WTF drives form validation and CSRF protection.
- Environment variables control secret keys and Flask’s run mode.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Environment Variables
    EnvVars["Environment Variables (.env)"]:::cloud
    EnvVars -->|feeds config| Config

    %% Backend Layer
    subgraph "Backend"
        subgraph "Configuration"
            Config["config.py"]:::flaskapp
        end
        subgraph "Extensions"
            Extensions["extensions.py"]:::flaskapp
        end
        subgraph "Route Layer"
            App["app.py"]:::flaskapp
        end
        subgraph "Business Logic"
            Forms["forms.py"]:::flaskapp
            Models["models.py"]:::flaskapp
        end
        subgraph "Data Layer"
            DB["SQLite Database"]:::db
        end
    end

    %% Frontend Layer
    subgraph "Frontend"
        Browser["Client Browser"]:::browser
        subgraph "Templates (Jinja2)"
            BaseT["base.html"]:::frontend
            HomeT["home.html"]:::frontend
            ContactT["contact.html"]:::frontend
            LoginT["admin_login.html"]:::frontend
            DashboardT["admin_dashboard.html"]:::frontend
            ManageAdminsT["manage_admins.html"]:::frontend
        end
        subgraph "Static Assets"
            CSS["style.css"]:::frontend
            JS["script.js"]:::frontend
        end
    end

    %% Dependencies & Docs
    Requirements["requirements.txt"]:::cloud
    README["README.md"]:::cloud

    %% Interactions
    Browser -->|GET/POST HTTP| App
    Browser -->|loads CSS/JS| CSS
    Browser -->|loads CSS/JS| JS
    App -->|renders| BaseT
    App -->|renders| HomeT
    App -->|renders| ContactT
    App -->|renders| LoginT
    App -->|renders| DashboardT
    App -->|renders| ManageAdminsT
    App -->|uses| Config
    App -->|initializes| Extensions
    App -->|validates via| Forms
    Forms -->|maps to| Models
    Models -->|ORM writes to| DB
    Extensions -->|provides| Models
    Extensions -->|provides| Forms
    Extensions -->|provides| App
    Config -->|configures| Extensions
    Requirements -->|lists deps| App
    README -->|docs| App

    %% Click Events
    click App "https://github.com/gspagare/contact_management_system/blob/main/app.py"
    click Config "https://github.com/gspagare/contact_management_system/blob/main/config.py"
    click Extensions "https://github.com/gspagare/contact_management_system/blob/main/extensions.py"
    click Forms "https://github.com/gspagare/contact_management_system/blob/main/forms.py"
    click Models "https://github.com/gspagare/contact_management_system/blob/main/models.py"
    click BaseT "https://github.com/gspagare/contact_management_system/blob/main/templates/base.html"
    click HomeT "https://github.com/gspagare/contact_management_system/blob/main/templates/home.html"
    click ContactT "https://github.com/gspagare/contact_management_system/blob/main/templates/contact.html"
    click LoginT "https://github.com/gspagare/contact_management_system/blob/main/templates/admin_login.html"
    click DashboardT "https://github.com/gspagare/contact_management_system/blob/main/templates/admin_dashboard.html"
    click ManageAdminsT "https://github.com/gspagare/contact_management_system/blob/main/templates/manage_admins.html"
    click CSS "https://github.com/gspagare/contact_management_system/blob/main/static/css/style.css"
    click JS "https://github.com/gspagare/contact_management_system/blob/main/static/js/script.js"
    click Requirements "https://github.com/gspagare/contact_management_system/blob/main/requirements.txt"
    click README "https://github.com/gspagare/contact_management_system/blob/main/README.md"

    %% Styles
    classDef flaskapp fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef db fill:#90EE90,stroke:#000,stroke-width:1px
    classDef cloud fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef browser fill:#FFD700,stroke:#000,stroke-width:1px
    classDef frontend fill:#FFE4E1,stroke:#000,stroke-width:1px
```
