# adityathube96k-stack/smart-calculator architecture

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

- Interactive diagram: https://gitdiagram.com/adityathube96k-stack/smart-calculator
- Repository: https://github.com/adityathube96k-stack/smart-calculator

## Overview

Smart Calculator is a Flask web app whose main workflow accepts calculator inputs through route endpoints, validates and calculates results, returns JSON to browser tools, and saves results to history for signed-in users. It also serves Jinja pages and supports accounts, favorites, and dark mode. The graph emphasizes the documented calculator suite and source-visible backend calls; browser assets and unsampled subsystems are represented at directory level where their exact wiring was not shown.

Main entry points: [`app.py`](https://github.com/adityathube96k-stack/smart-calculator/blob/main/app.py) (Flask app), [`utils/helpers.py`](https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/helpers.py) (Responses and history), [`utils/validators.py`](https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/validators.py) (Input validation), [`routes/calculator.py`](https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/calculator.py) (Basic calculator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Flask app<br/>[app.py]"]
  node_pages["Calculator pages"]
  node_browser["Browser tools"]
end

subgraph group_calculators["Calculator workflows"]
  node_calculator_routes["Basic calculator<br/>[calculator.py]"]
  node_scientific_routes["Scientific calculator<br/>[scientific.py]"]
  node_age_routes["Age and time<br/>[age.py]"]
  node_converter_routes["Conversion and BMI<br/>[converter.py]"]
  node_finance_routes["Financial suite<br/>[finance.py]"]
end

subgraph group_identity["Accounts and history"]
  node_account_pages["Account pages"]
  node_response_history["Responses and history<br/>[helpers.py]"]
  node_auth_routes["Accounts<br/>[auth.py]"]
  node_history_routes["History and favorites<br/>[history.py]"]
end

subgraph group_core["Calculation core"]
  node_age_logic["Age calculations<br/>[age.py]"]
  node_math_logic["Math calculations<br/>[calculator.py]"]
  node_converter_logic["Conversion logic<br/>[converters.py]"]
  node_finance_logic["Finance logic<br/>[finance.py]"]
  node_validation["Input validation<br/>[validators.py]"]
end

subgraph group_persistence["Persistence"]
  node_database_init["Database setup<br/>[database.py]"]
  node_models["User and records<br/>[models.py]"]
  node_sqlite[("Relational database")]
end

node_visitor(("Visitor"))
node_currency_service["Exchange-rate service"]

node_visitor -->|"opens"| node_app
node_app -->|"registers"| node_calculator_routes
node_app -->|"registers"| node_scientific_routes
node_app -->|"registers"| node_age_routes
node_app -->|"registers"| node_converter_routes
node_app -->|"registers"| node_finance_routes
node_app -->|"registers"| node_auth_routes
node_app -->|"registers"| node_history_routes
node_app -->|"initializes"| node_database_init
node_app -->|"loads user"| node_models
node_visitor -->|"views"| node_pages
node_browser -.->|"submits inputs"| node_calculator_routes
node_calculator_routes -->|"evaluates"| node_math_logic
node_scientific_routes -->|"calculates"| node_math_logic
node_age_routes -->|"calculates"| node_age_logic
node_converter_routes -->|"converts"| node_converter_logic
node_finance_routes -->|"calculates"| node_finance_logic
node_calculator_routes -->|"validates"| node_validation
node_scientific_routes -->|"validates"| node_validation
node_age_routes -->|"validates"| node_validation
node_converter_routes -->|"validates"| node_validation
node_finance_routes -->|"validates"| node_validation
node_calculator_routes -->|"responds and saves"| node_response_history
node_scientific_routes -->|"responds and saves"| node_response_history
node_age_routes -->|"responds and saves"| node_response_history
node_converter_routes -->|"responds and saves"| node_response_history
node_finance_routes -->|"responds and saves"| node_response_history
node_auth_routes -->|"validates credentials"| node_validation
node_auth_routes -->|"queries and creates"| node_models
node_history_routes -->|"reads records"| node_models
node_response_history -->|"creates history"| node_models
node_database_init -.->|"binds and creates"| node_sqlite
node_models -->|"uses ORM"| node_database_init
node_converter_logic -->|"requests rates"| node_currency_service
node_visitor -->|"registers or logs in"| node_auth_routes
node_visitor -->|"views history"| node_history_routes

click node_app "https://github.com/adityathube96k-stack/smart-calculator/blob/main/app.py"
click node_pages "https://github.com/adityathube96k-stack/smart-calculator/tree/main/templates"
click node_browser "https://github.com/adityathube96k-stack/smart-calculator/tree/main/static/js"
click node_account_pages "https://github.com/adityathube96k-stack/smart-calculator/tree/main/templates"
click node_calculator_routes "https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/calculator.py"
click node_scientific_routes "https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/scientific.py"
click node_age_routes "https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/age.py"
click node_converter_routes "https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/converter.py"
click node_finance_routes "https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/finance.py"
click node_age_logic "https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/age.py"
click node_math_logic "https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/calculator.py"
click node_converter_logic "https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/converters.py"
click node_finance_logic "https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/finance.py"
click node_validation "https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/validators.py"
click node_response_history "https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/helpers.py"
click node_auth_routes "https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/auth.py"
click node_history_routes "https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/history.py"
click node_database_init "https://github.com/adityathube96k-stack/smart-calculator/blob/main/database/database.py"
click node_models "https://github.com/adityathube96k-stack/smart-calculator/blob/main/database/models.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_pages,node_browser toneBlue
class node_calculator_routes,node_scientific_routes,node_age_routes,node_converter_routes,node_finance_routes toneAmber
class node_account_pages,node_response_history,node_auth_routes,node_history_routes toneMint
class node_age_logic,node_math_logic,node_converter_logic,node_finance_logic,node_validation toneRose
class node_database_init,node_models,node_sqlite,node_visitor,node_currency_service toneIndigo
```

## Components

### Web application

- [Flask app](https://github.com/adityathube96k-stack/smart-calculator/blob/main/app.py): `app.py`
- [Calculator pages](https://github.com/adityathube96k-stack/smart-calculator/tree/main/templates): `templates`
- [Browser tools](https://github.com/adityathube96k-stack/smart-calculator/tree/main/static/js): `static/js`

### Calculator workflows

- [Basic calculator](https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/calculator.py): `routes/calculator.py`
- [Scientific calculator](https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/scientific.py): `routes/scientific.py`
- [Age and time](https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/age.py): `routes/age.py`
- [Conversion and BMI](https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/converter.py): `routes/converter.py`
- [Financial suite](https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/finance.py): `routes/finance.py`

### Accounts and history

- [Account pages](https://github.com/adityathube96k-stack/smart-calculator/tree/main/templates): `templates`
- [Responses and history](https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/helpers.py): `utils/helpers.py`
- [Accounts](https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/auth.py): `routes/auth.py`
- [History and favorites](https://github.com/adityathube96k-stack/smart-calculator/blob/main/routes/history.py): `routes/history.py`

### Calculation core

- [Age calculations](https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/age.py): `utils/age.py`
- [Math calculations](https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/calculator.py): `utils/calculator.py`
- [Conversion logic](https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/converters.py): `utils/converters.py`
- [Finance logic](https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/finance.py): `utils/finance.py`
- [Input validation](https://github.com/adityathube96k-stack/smart-calculator/blob/main/utils/validators.py): `utils/validators.py`

### Persistence

- [Database setup](https://github.com/adityathube96k-stack/smart-calculator/blob/main/database/database.py): `database/database.py`
- [User and records](https://github.com/adityathube96k-stack/smart-calculator/blob/main/database/models.py): `database/models.py`
- **Relational database**

### Other components

- **Visitor**
- **Exchange-rate service**

## Connections

- Visitor → Flask app: opens (evidence: `README.md`)
- Flask app → Basic calculator: registers (evidence: `app.py`)
- Flask app → Scientific calculator: registers (evidence: `app.py`)
- Flask app → Age and time: registers (evidence: `app.py`)
- Flask app → Conversion and BMI: registers (evidence: `app.py`)
- Flask app → Financial suite: registers (evidence: `app.py`)
- Flask app → Accounts: registers (evidence: `app.py`)
- Flask app → History and favorites: registers (evidence: `app.py`)
- Flask app → Database setup: initializes (evidence: `app.py`)
- Flask app → User and records: loads user (evidence: `app.py`)
- Visitor → Calculator pages: views (evidence: `README.md`)
- Browser tools → Basic calculator: submits inputs
- Basic calculator → Math calculations: evaluates (evidence: `routes/calculator.py`)
- Scientific calculator → Math calculations: calculates (evidence: `routes/scientific.py`)
- Age and time → Age calculations: calculates (evidence: `routes/age.py`)
- Conversion and BMI → Conversion logic: converts (evidence: `routes/converter.py`)
- Financial suite → Finance logic: calculates (evidence: `routes/finance.py`)
- Basic calculator → Input validation: validates (evidence: `routes/calculator.py`)
- Scientific calculator → Input validation: validates (evidence: `routes/scientific.py`)
- Age and time → Input validation: validates (evidence: `routes/age.py`)
- Conversion and BMI → Input validation: validates (evidence: `routes/converter.py`)
- Financial suite → Input validation: validates (evidence: `routes/finance.py`)
- Basic calculator → Responses and history: responds and saves (evidence: `routes/calculator.py`)
- Scientific calculator → Responses and history: responds and saves (evidence: `routes/scientific.py`)
- Age and time → Responses and history: responds and saves (evidence: `routes/age.py`)
- Conversion and BMI → Responses and history: responds and saves (evidence: `routes/converter.py`)
- Financial suite → Responses and history: responds and saves (evidence: `routes/finance.py`)
- Accounts → Input validation: validates credentials (evidence: `routes/auth.py`)
- Accounts → User and records: queries and creates (evidence: `routes/auth.py`)
- History and favorites → User and records: reads records (evidence: `routes/history.py`)
- Responses and history → User and records: creates history (evidence: `utils/helpers.py`)
- Database setup → Relational database: binds and creates
- User and records → Database setup: uses ORM (evidence: `database/models.py`)
- Conversion logic → Exchange-rate service: requests rates (evidence: `utils/converters.py`)
- Visitor → Accounts: registers or logs in (evidence: `README.md`)
- Visitor → History and favorites: views history (evidence: `README.md`)
