# ondiekochieng/automobile-spares-management-system architecture

> Architecture diagram of the GitHub repository ondiekochieng/automobile-spares-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ondiekochieng/automobile-spares-management-system
- Repository: https://github.com/ondiekochieng/automobile-spares-management-system

## Overview

This Flask automobile-spares management application serves authenticated staff pages for a dashboard, inventory, sales, purchases, invoices, and quotes. The evidenced workflow is staff login, then viewing or managing spares and submitting quote requests; spare images are saved locally, while records use SQLite through SQLAlchemy. Sales, purchases, and invoice pages are present, but the sampled routes only render those screens, so their business workflows are not inferred. Relationships reflect the sampled routes and README; unsampled page behavior is not assumed.

Main entry points: [`main.py`](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/main.py) (Main routes), [`auth/routes.py`](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/auth/routes.py) (Auth routes), [`models.py`](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/models.py) (Data models), [`main_app.py`](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/main_app.py) (App setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application"]
  node_app_factory["App setup<br/>[main_app.py]"]
  node_main_routes["Main routes<br/>[main.py]"]
end

subgraph group_identity["Identity"]
  node_auth_routes["Auth routes<br/>[routes.py]"]
  node_auth_forms["Login forms<br/>[forms.py]"]
  node_auth_page["Authentication page<br/>[auth.html]"]
end

subgraph group_records["Business records"]
  node_business_forms["Quote and spare forms<br/>[forms.py]"]
  node_models["Data models<br/>[models.py]"]
  node_sqlite[("SQLite database<br/>[realspear.db]")]
  node_image_upload["Image upload<br/>[utils.py]"]
end

subgraph group_staff_pages["Staff pages"]
  node_home_page["Home page<br/>[index.html]"]
  node_dashboard_page["Dashboard page<br/>[dashboard.html]"]
  node_spares_page["Spares page<br/>[spares.html]"]
  node_add_page["Add spare page<br/>[add.html]"]
  node_quotes_page["Quotes page<br/>[quotes.html]"]
  node_sales_page["Sales page<br/>[sales.html]"]
  node_purchases_page["Purchases page<br/>[purchases.html]"]
  node_invoices_page["Invoices page<br/>[invoices.html]"]
end

node_staff(("Staff user"))

node_staff -->|"signs in"| node_auth_routes
node_app_factory -->|"registers blueprint"| node_auth_routes
node_auth_routes -->|"validates with"| node_auth_forms
node_auth_routes -->|"queries and creates"| node_models
node_auth_routes -->|"renders"| node_auth_page
node_staff -->|"uses authenticated pages"| node_main_routes
node_main_routes -->|"validates requests"| node_business_forms
node_main_routes -->|"queries and commits"| node_models
node_main_routes -->|"uploads images"| node_image_upload
node_main_routes -->|"renders"| node_home_page
node_main_routes -->|"renders"| node_dashboard_page
node_main_routes -->|"renders"| node_spares_page
node_main_routes -->|"renders"| node_add_page
node_main_routes -->|"renders"| node_quotes_page
node_main_routes -->|"renders"| node_sales_page
node_main_routes -->|"renders"| node_purchases_page
node_main_routes -->|"renders"| node_invoices_page
node_models -->|"persists records"| node_sqlite
node_app_factory -->|"configures SQLite"| node_sqlite

click node_app_factory "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/main_app.py"
click node_main_routes "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/main.py"
click node_auth_routes "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/auth/routes.py"
click node_auth_forms "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/auth/forms.py"
click node_business_forms "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/forms.py"
click node_models "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/models.py"
click node_sqlite "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/realspear.db"
click node_image_upload "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/utils.py"
click node_auth_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/auth.html"
click node_home_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/index.html"
click node_dashboard_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/dashboard.html"
click node_spares_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/spares.html"
click node_add_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/add.html"
click node_quotes_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/quotes.html"
click node_sales_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/sales.html"
click node_purchases_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/purchases.html"
click node_invoices_page "https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/invoices.html"

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_main_routes,node_staff toneBlue
class node_auth_routes,node_auth_forms,node_auth_page toneAmber
class node_business_forms,node_models,node_sqlite,node_image_upload toneMint
class node_home_page,node_dashboard_page,node_spares_page,node_add_page,node_quotes_page,node_sales_page,node_purchases_page,node_invoices_page toneRose
```

## Components

### Application

- [App setup](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/main_app.py): `main_app.py`
- [Main routes](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/main.py): `main.py`

### Identity

- [Auth routes](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/auth/routes.py): `auth/routes.py`
- [Login forms](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/auth/forms.py): `auth/forms.py`
- [Authentication page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/auth.html): `templates/auth.html`

### Business records

- [Quote and spare forms](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/forms.py): `forms.py`
- [Data models](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/models.py): `models.py`
- [SQLite database](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/realspear.db): `realspear.db`
- [Image upload](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/utils.py): `utils.py`

### Staff pages

- [Home page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/index.html): `templates/index.html`
- [Dashboard page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/dashboard.html): `templates/dashboard.html`
- [Spares page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/spares.html): `templates/spares.html`
- [Add spare page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/add.html): `templates/add.html`
- [Quotes page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/quotes.html): `templates/quotes.html`
- [Sales page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/sales.html): `templates/sales.html`
- [Purchases page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/purchases.html): `templates/purchases.html`
- [Invoices page](https://github.com/ondiekochieng/automobile-spares-management-system/blob/main/templates/invoices.html): `templates/invoices.html`

### Other components

- **Staff user**

## Connections

- Staff user → Auth routes: signs in (evidence: `auth/routes.py`)
- App setup → Auth routes: registers blueprint (evidence: `main_app.py`)
- Auth routes → Login forms: validates with (evidence: `auth/routes.py`)
- Auth routes → Data models: queries and creates (evidence: `auth/routes.py`)
- Auth routes → Authentication page: renders (evidence: `auth/routes.py`)
- Staff user → Main routes: uses authenticated pages (evidence: `main.py`)
- Main routes → Quote and spare forms: validates requests (evidence: `main.py`)
- Main routes → Data models: queries and commits (evidence: `main.py`)
- Main routes → Image upload: uploads images (evidence: `main.py`)
- Main routes → Home page: renders (evidence: `main.py`)
- Main routes → Dashboard page: renders (evidence: `main.py`)
- Main routes → Spares page: renders (evidence: `main.py`)
- Main routes → Add spare page: renders (evidence: `main.py`)
- Main routes → Quotes page: renders (evidence: `main.py`)
- Main routes → Sales page: renders (evidence: `main.py`)
- Main routes → Purchases page: renders (evidence: `main.py`)
- Main routes → Invoices page: renders (evidence: `main.py`)
- Data models → SQLite database: persists records
- App setup → SQLite database: configures SQLite (evidence: `main_app.py`)
