# kjq2000/imtool architecture

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

## Overview

IMtool is an inventory-management web application for maintaining stock, purchases, sales, bookings, and related records, with spreadsheet import support. The visible workflow is a user interacting with the Flask application, which renders pages, accesses its database layer, and can launch an import; the importer validates tabular files and batch-inserts records. The tree also contains a separate Flask notes/authentication app and a standalone CockroachDB client. The primary app is only partially excerpted, so its less-visible features are grouped by domain rather than assigned speculative call paths.

Main entry points: [`IMtool app/website/app.py`](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/app.py) (Inventory web app), [`IMtool app/website/Import.py`](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/Import.py) (Spreadsheet importer), [`flask app/website/__init__.py`](https://github.com/kjq2000/imtool/blob/main/flask%20app/website/__init__.py) (Notes app setup), [`flask app/website/auth.py`](https://github.com/kjq2000/imtool/blob/main/flask%20app/website/auth.py) (Account authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inventory["Inventory management"]
  node_webapp["Inventory web app<br/>[app.py]"]
  node_records["Stock and purchases<br/>[app.py]"]
  node_sales["Sales and bookings<br/>[app.py]"]
  node_templates["Web pages"]
  node_barcode["Barcode generation<br/>[barcode.py]"]
  node_config["App configuration<br/>[dictionary.py]"]
end

subgraph group_ingest["File ingestion"]
  node_importer["Spreadsheet importer<br/>[Import.py]"]
  node_importfiles["Import files"]
end

subgraph group_storage["Database access"]
  node_dbmodel["Inventory database layer<br/>[models.py]"]
  node_cockroachclient["CockroachDB client"]
  node_cockroach[("CockroachDB")]
end

subgraph group_starter["Separate Flask app"]
  node_flaskapp["Notes app setup<br/>[__init__.py]"]
  node_auth["Account authentication<br/>[auth.py]"]
  node_notes["Notes routes<br/>[views.py]"]
  node_usermodel["Notes data models<br/>[models.py]"]
  node_flaskdb[("Notes database")]
end

node_user(("Inventory user"))
node_flaskuser(("Notes app user"))

node_user -.->|"uses"| node_webapp
node_webapp -->|"renders"| node_templates
node_webapp -->|"queries"| node_dbmodel
node_webapp -->|"launches"| node_importer
node_importer -->|"processes"| node_importfiles
node_importer -->|"batch inserts"| node_dbmodel
node_importer -->|"uses paths"| node_config
node_cockroachclient -->|"queries"| node_cockroach
node_flaskuser -.->|"uses"| node_flaskapp
node_flaskapp -->|"registers"| node_auth
node_flaskapp -->|"registers"| node_notes
node_auth -->|"looks up"| node_usermodel
node_auth -->|"commits account"| node_flaskdb
node_notes -->|"creates notes"| node_usermodel
node_notes -->|"commits notes"| node_flaskdb

click node_webapp "https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/app.py"
click node_records "https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/app.py"
click node_sales "https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/app.py"
click node_templates "https://github.com/kjq2000/imtool/tree/main/IMtool%20app/website/templates"
click node_barcode "https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/barcode.py"
click node_config "https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/dictionary.py"
click node_importer "https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/Import.py"
click node_importfiles "https://github.com/kjq2000/imtool/tree/main/IMtool%20app/system_files/Import"
click node_dbmodel "https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/models.py"
click node_cockroachclient "https://github.com/kjq2000/imtool/blob/main/CockroachDB_Connection.py"
click node_flaskapp "https://github.com/kjq2000/imtool/blob/main/flask%20app/website/__init__.py"
click node_auth "https://github.com/kjq2000/imtool/blob/main/flask%20app/website/auth.py"
click node_notes "https://github.com/kjq2000/imtool/blob/main/flask%20app/website/views.py"
click node_usermodel "https://github.com/kjq2000/imtool/blob/main/flask%20app/website/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_webapp,node_records,node_sales,node_templates,node_barcode,node_config,node_user,node_flaskuser toneBlue
class node_importer,node_importfiles toneAmber
class node_dbmodel,node_cockroachclient,node_cockroach toneMint
class node_flaskapp,node_auth,node_notes,node_usermodel,node_flaskdb toneRose
```

## Components

### Inventory management

- [Inventory web app](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/app.py): `IMtool app/website/app.py`
- [Stock and purchases](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/app.py): `IMtool app/website/app.py`
- [Sales and bookings](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/app.py): `IMtool app/website/app.py`
- [Web pages](https://github.com/kjq2000/imtool/tree/main/IMtool%20app/website/templates): `IMtool app/website/templates`
- [Barcode generation](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/barcode.py): `IMtool app/website/barcode.py`
- [App configuration](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/dictionary.py): `IMtool app/website/dictionary.py`

### File ingestion

- [Spreadsheet importer](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/Import.py): `IMtool app/website/Import.py`
- [Import files](https://github.com/kjq2000/imtool/tree/main/IMtool%20app/system_files/Import): `IMtool app/system_files/Import`

### Database access

- [Inventory database layer](https://github.com/kjq2000/imtool/blob/main/IMtool%20app/website/models.py): `IMtool app/website/models.py`
- [CockroachDB client](https://github.com/kjq2000/imtool/blob/main/CockroachDB_Connection.py): `CockroachDB_Connection.py`
- **CockroachDB**

### Separate Flask app

- [Notes app setup](https://github.com/kjq2000/imtool/blob/main/flask%20app/website/__init__.py): `flask app/website/__init__.py`
- [Account authentication](https://github.com/kjq2000/imtool/blob/main/flask%20app/website/auth.py): `flask app/website/auth.py`
- [Notes routes](https://github.com/kjq2000/imtool/blob/main/flask%20app/website/views.py): `flask app/website/views.py`
- [Notes data models](https://github.com/kjq2000/imtool/blob/main/flask%20app/website/models.py): `flask app/website/models.py`
- **Notes database**

### Other components

- **Inventory user**
- **Notes app user**

## Connections

- Inventory user → Inventory web app: uses
- Inventory web app → Web pages: renders (evidence: `IMtool app/website/app.py`)
- Inventory web app → Inventory database layer: queries (evidence: `IMtool app/website/app.py`)
- Inventory web app → Spreadsheet importer: launches (evidence: `IMtool app/website/app.py`)
- Spreadsheet importer → Import files: processes (evidence: `IMtool app/website/Import.py`)
- Spreadsheet importer → Inventory database layer: batch inserts (evidence: `IMtool app/website/Import.py`)
- Spreadsheet importer → App configuration: uses paths (evidence: `IMtool app/website/Import.py`)
- CockroachDB client → CockroachDB: queries (evidence: `CockroachDB_Connection.py`)
- Notes app user → Notes app setup: uses
- Notes app setup → Account authentication: registers (evidence: `flask app/website/__init__.py`)
- Notes app setup → Notes routes: registers (evidence: `flask app/website/__init__.py`)
- Account authentication → Notes data models: looks up (evidence: `flask app/website/auth.py`)
- Account authentication → Notes database: commits account (evidence: `flask app/website/auth.py`)
- Notes routes → Notes data models: creates notes (evidence: `flask app/website/views.py`)
- Notes routes → Notes database: commits notes (evidence: `flask app/website/views.py`)
