# nkasg/okemzhub-technext360 architecture

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

## Overview

Okemzhub Inventory & Business Management is a FastAPI-backed platform for two retail businesses that share stock while keeping separate financial records. The principal workflow is staff/admin authentication, then managing products and stock, handling inventory requests, recording sales or expenses, and reviewing business activity; a served JavaScript frontend provides the user interface. The graph preserves the documented domain capabilities, with ORM models and request schemas shown as internal layers. Router-to-model links follow the source index; frontend/API wiring beyond the README’s static-serving statement is not established by the excerpts.

Main entry points: [`app/main.py`](https://github.com/nkasg/okemzhub-technext360/blob/main/app/main.py) (App entry), [`app/dependencies.py`](https://github.com/nkasg/okemzhub-technext360/blob/main/app/dependencies.py) (Access dependencies), [`app/routers/auth.py`](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/auth.py) (Authentication), [`app/routers/stock_batches.py`](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/stock_batches.py) (Stock batches)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_main["App entry<br/>[main.py]"]
  node_database[("Database sessions<br/>[database.py]")]
  node_config["Runtime settings<br/>[config.py]"]
end

subgraph group_identity["Identity and access"]
  node_security["Password and JWT<br/>[security.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_access["Access dependencies<br/>[dependencies.py]"]
  node_users["User accounts<br/>[users.py]"]
  node_user_model[("User records<br/>[user.py]")]
  node_login_logs["Login auditing<br/>[login_logs.py]"]
  node_login_model[("Login log records<br/>[login_log.py]")]
  node_user_schema["User schemas<br/>[user.py]"]
end

subgraph group_inventory["Shared inventory"]
  node_products["Product catalog<br/>[products.py]"]
  node_product_model[("Product records<br/>[product.py]")]
  node_inventory["Inventory items<br/>[inventory.py]"]
  node_inventory_model[("Inventory records<br/>[inventory.py]")]
  node_stock_batches["Stock batches<br/>[stock_batches.py]"]
  node_batch_model[("Stock batch records<br/>[stock_batch.py]")]
  node_requests["Inventory requests"]
  node_request_model[("Request records")]
  node_inventory_schema["Inventory schemas<br/>[inventory.py]"]
  node_product_schema["Product schemas<br/>[product.py]"]
end

subgraph group_business["Business operations"]
  node_sales["Sales tracking<br/>[sales.py]"]
  node_sale_model[("Sale records<br/>[sale.py]")]
  node_expenses["Expense management<br/>[expenses.py]"]
  node_expense_model[("Expense records<br/>[expense.py]")]
  node_business_model[("Business identities<br/>[business.py]")]
end

subgraph group_client["Web client"]
  node_api_client["API client<br/>[api.js]"]
  node_web_app["Single-page frontend<br/>[app.js]"]
end

node_staff(("Staff or admin"))

node_staff -->|"uses"| node_web_app
node_web_app -.->|"uses"| node_api_client
node_main -->|"initializes"| node_database
node_main -->|"registers"| node_auth
node_main -->|"registers"| node_users
node_main -->|"registers"| node_products
node_main -->|"registers"| node_inventory
node_main -->|"registers"| node_requests
node_main -->|"registers"| node_stock_batches
node_main -->|"registers"| node_sales
node_main -->|"registers"| node_expenses
node_main -->|"registers"| node_login_logs
node_main -->|"serves"| node_web_app
node_database -->|"reads settings"| node_config
node_auth -->|"verifies and signs"| node_security
node_auth -->|"gets database"| node_access
node_auth -->|"looks up"| node_user_model
node_auth -->|"records attempts"| node_login_model
node_access -->|"decodes token"| node_security
node_access -->|"loads user"| node_user_model
node_users -->|"requires access"| node_access
node_users -->|"manages"| node_user_model
node_users -->|"validates"| node_user_schema
node_login_logs -->|"requires access"| node_access
node_login_logs -->|"queries"| node_login_model
node_products -->|"requires access"| node_access
node_products -->|"manages"| node_product_model
node_products -->|"validates"| node_product_schema
node_inventory -->|"requires access"| node_access
node_inventory -->|"manages"| node_inventory_model
node_inventory -->|"validates"| node_inventory_schema
node_stock_batches -->|"requires access"| node_access
node_stock_batches -->|"manages"| node_batch_model
node_stock_batches -->|"updates"| node_inventory_model
node_stock_batches -->|"validates"| node_inventory_schema
node_requests -->|"requires access"| node_access
node_requests -->|"manages"| node_request_model
node_requests -->|"updates"| node_inventory_model
node_sales -->|"requires access"| node_access
node_sales -->|"records"| node_sale_model
node_sales -->|"updates"| node_inventory_model
node_expenses -->|"requires access"| node_access
node_expenses -->|"manages"| node_expense_model
node_sale_model -->|"scopes business"| node_business_model
node_expense_model -->|"scopes business"| node_business_model
node_user_model -->|"belongs to"| node_business_model

click node_main "https://github.com/nkasg/okemzhub-technext360/blob/main/app/main.py"
click node_database "https://github.com/nkasg/okemzhub-technext360/blob/main/app/database.py"
click node_config "https://github.com/nkasg/okemzhub-technext360/blob/main/app/core/config.py"
click node_security "https://github.com/nkasg/okemzhub-technext360/blob/main/app/core/security.py"
click node_auth "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/auth.py"
click node_access "https://github.com/nkasg/okemzhub-technext360/blob/main/app/dependencies.py"
click node_users "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/users.py"
click node_user_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/user.py"
click node_login_logs "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/login_logs.py"
click node_login_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/login_log.py"
click node_products "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/products.py"
click node_product_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/product.py"
click node_inventory "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/inventory.py"
click node_inventory_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/inventory.py"
click node_stock_batches "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/stock_batches.py"
click node_batch_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/stock_batch.py"
click node_requests "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/inventory_requests.py"
click node_request_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/inventory_request.py"
click node_sales "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/sales.py"
click node_sale_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/sale.py"
click node_expenses "https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/expenses.py"
click node_expense_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/expense.py"
click node_business_model "https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/business.py"
click node_inventory_schema "https://github.com/nkasg/okemzhub-technext360/blob/main/app/schemas/inventory.py"
click node_product_schema "https://github.com/nkasg/okemzhub-technext360/blob/main/app/schemas/product.py"
click node_user_schema "https://github.com/nkasg/okemzhub-technext360/blob/main/app/schemas/user.py"
click node_api_client "https://github.com/nkasg/okemzhub-technext360/blob/main/frontend/static/js/api.js"
click node_web_app "https://github.com/nkasg/okemzhub-technext360/blob/main/frontend/static/js/app.js"

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_main,node_database,node_config toneBlue
class node_security,node_auth,node_access,node_users,node_user_model,node_login_logs,node_login_model,node_user_schema toneAmber
class node_products,node_product_model,node_inventory,node_inventory_model,node_stock_batches,node_batch_model,node_requests,node_request_model,node_inventory_schema,node_product_schema toneMint
class node_sales,node_sale_model,node_expenses,node_expense_model,node_business_model toneRose
class node_api_client,node_web_app,node_staff toneIndigo
```

## Components

### Application runtime

- [App entry](https://github.com/nkasg/okemzhub-technext360/blob/main/app/main.py): `app/main.py`
- [Database sessions](https://github.com/nkasg/okemzhub-technext360/blob/main/app/database.py): `app/database.py`
- [Runtime settings](https://github.com/nkasg/okemzhub-technext360/blob/main/app/core/config.py): `app/core/config.py`

### Identity and access

- [Password and JWT](https://github.com/nkasg/okemzhub-technext360/blob/main/app/core/security.py): `app/core/security.py`
- [Authentication](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/auth.py): `app/routers/auth.py`
- [Access dependencies](https://github.com/nkasg/okemzhub-technext360/blob/main/app/dependencies.py): `app/dependencies.py`
- [User accounts](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/users.py): `app/routers/users.py`
- [User records](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/user.py): `app/models/user.py`
- [Login auditing](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/login_logs.py): `app/routers/login_logs.py`
- [Login log records](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/login_log.py): `app/models/login_log.py`
- [User schemas](https://github.com/nkasg/okemzhub-technext360/blob/main/app/schemas/user.py): `app/schemas/user.py`

### Shared inventory

- [Product catalog](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/products.py): `app/routers/products.py`
- [Product records](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/product.py): `app/models/product.py`
- [Inventory items](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/inventory.py): `app/routers/inventory.py`
- [Inventory records](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/inventory.py): `app/models/inventory.py`
- [Stock batches](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/stock_batches.py): `app/routers/stock_batches.py`
- [Stock batch records](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/stock_batch.py): `app/models/stock_batch.py`
- [Inventory requests](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/inventory_requests.py): `app/routers/inventory_requests.py`
- [Request records](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/inventory_request.py): `app/models/inventory_request.py`
- [Inventory schemas](https://github.com/nkasg/okemzhub-technext360/blob/main/app/schemas/inventory.py): `app/schemas/inventory.py`
- [Product schemas](https://github.com/nkasg/okemzhub-technext360/blob/main/app/schemas/product.py): `app/schemas/product.py`

### Business operations

- [Sales tracking](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/sales.py): `app/routers/sales.py`
- [Sale records](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/sale.py): `app/models/sale.py`
- [Expense management](https://github.com/nkasg/okemzhub-technext360/blob/main/app/routers/expenses.py): `app/routers/expenses.py`
- [Expense records](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/expense.py): `app/models/expense.py`
- [Business identities](https://github.com/nkasg/okemzhub-technext360/blob/main/app/models/business.py): `app/models/business.py`

### Web client

- [API client](https://github.com/nkasg/okemzhub-technext360/blob/main/frontend/static/js/api.js): `frontend/static/js/api.js`
- [Single-page frontend](https://github.com/nkasg/okemzhub-technext360/blob/main/frontend/static/js/app.js): `frontend/static/js/app.js`

### Other components

- **Staff or admin**

## Connections

- Staff or admin → Single-page frontend: uses (evidence: `README.md`)
- Single-page frontend → API client: uses
- App entry → Database sessions: initializes (evidence: `app/main.py`)
- App entry → Authentication: registers (evidence: `app/main.py`)
- App entry → User accounts: registers (evidence: `app/main.py`)
- App entry → Product catalog: registers (evidence: `app/main.py`)
- App entry → Inventory items: registers (evidence: `app/main.py`)
- App entry → Inventory requests: registers (evidence: `app/main.py`)
- App entry → Stock batches: registers (evidence: `app/main.py`)
- App entry → Sales tracking: registers (evidence: `app/main.py`)
- App entry → Expense management: registers (evidence: `app/main.py`)
- App entry → Login auditing: registers (evidence: `app/main.py`)
- App entry → Single-page frontend: serves (evidence: `README.md`)
- Database sessions → Runtime settings: reads settings (evidence: `app/database.py`)
- Authentication → Password and JWT: verifies and signs (evidence: `app/routers/auth.py`)
- Authentication → Access dependencies: gets database (evidence: `app/routers/auth.py`)
- Authentication → User records: looks up (evidence: `app/routers/auth.py`)
- Authentication → Login log records: records attempts (evidence: `app/routers/auth.py`)
- Access dependencies → Password and JWT: decodes token (evidence: `app/dependencies.py`)
- Access dependencies → User records: loads user (evidence: `app/dependencies.py`)
- User accounts → Access dependencies: requires access (evidence: `app/routers/users.py`)
- User accounts → User records: manages (evidence: `app/routers/users.py`)
- User accounts → User schemas: validates (evidence: `app/routers/users.py`)
- Login auditing → Access dependencies: requires access (evidence: `app/routers/login_logs.py`)
- Login auditing → Login log records: queries (evidence: `app/routers/login_logs.py`)
- Product catalog → Access dependencies: requires access (evidence: `app/routers/products.py`)
- Product catalog → Product records: manages (evidence: `app/routers/products.py`)
- Product catalog → Product schemas: validates (evidence: `app/routers/products.py`)
- Inventory items → Access dependencies: requires access (evidence: `app/routers/inventory.py`)
- Inventory items → Inventory records: manages (evidence: `app/routers/inventory.py`)
- Inventory items → Inventory schemas: validates (evidence: `app/routers/inventory.py`)
- Stock batches → Access dependencies: requires access (evidence: `app/routers/stock_batches.py`)
- Stock batches → Stock batch records: manages (evidence: `app/routers/stock_batches.py`)
- Stock batches → Inventory records: updates (evidence: `app/routers/stock_batches.py`)
- Stock batches → Inventory schemas: validates (evidence: `app/routers/stock_batches.py`)
- Inventory requests → Access dependencies: requires access (evidence: `app/routers/inventory_requests.py`)
- Inventory requests → Request records: manages (evidence: `app/routers/inventory_requests.py`)
- Inventory requests → Inventory records: updates (evidence: `app/routers/inventory_requests.py`)
- Sales tracking → Access dependencies: requires access (evidence: `app/routers/sales.py`)
- Sales tracking → Sale records: records (evidence: `app/routers/sales.py`)
- Sales tracking → Inventory records: updates (evidence: `app/routers/sales.py`)
- Expense management → Access dependencies: requires access (evidence: `app/routers/expenses.py`)
- Expense management → Expense records: manages (evidence: `app/routers/expenses.py`)
- Sale records → Business identities: scopes business (evidence: `app/models/sale.py`)
- Expense records → Business identities: scopes business (evidence: `app/models/expense.py`)
- User records → Business identities: belongs to (evidence: `app/models/user.py`)
