# pulindu-theekshana/inventix architecture

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

- Interactive diagram: https://gitdiagram.com/pulindu-theekshana/inventix
- Repository: https://github.com/pulindu-theekshana/inventix

## Overview

InventiX is a mobile inventory and ordering product for grocery businesses, with customer and supplier roles. The main customer workflow is to review stock, choose a supplier, draft a restock message, and submit an order; uploads, delivery tracking, reports, and supplier tools are other documented product areas. Frontend-to-backend writes go through the backend, while display reads may use Supabase directly. Sampled routes establish some service calls; several other links are documented only at a high level, so those are shown as unverified where useful.

Main entry points: [`backend/app/feeds/customer`](https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/feeds/customer) (Customer routes), [`frontend/src/api/client.ts`](https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/api/client.ts) (HTTP client), [`frontend/src/hooks/useOpenRestock.ts`](https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/hooks/useOpenRestock.ts) (Restock flow), [`backend/app/core/supabase.py`](https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/core/supabase.py) (Supabase data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_customer_app["Customer screens"]
  node_supplier_app["Supplier screens"]
  node_auth_app["Sign-in screens"]
  node_restock_flow["Restock flow<br/>[useOpenRestock.ts]"]
  node_draft_store["Restock draft"]
  node_api_client["HTTP client<br/>[client.ts]"]
  node_orders_api["Ordering API<br/>[ordering.ts]"]
  node_suppliers_api["Supplier API<br/>[suppliers.ts]"]
  node_auth_state["Auth state<br/>[authStore.ts]"]
end

subgraph group_api["Backend feeds"]
  node_customer_routes["Customer routes"]
  node_supplier_routes["Supplier routes"]
  node_shared_routes["Shared routes"]
end

subgraph group_domain["Business logic"]
  node_ordering_service["Order handling<br/>[service.py]"]
  node_stock_service["Stock handling<br/>[service.py]"]
  node_upload_service["Stock uploads<br/>[service.py]"]
  node_domain_rules["Inventory and order rules"]
  node_ml["Forecasting and ranking"]
end

subgraph group_platform["Data and jobs"]
  node_jobs["Scheduled jobs"]
  node_identity["Auth and role checks<br/>[dependencies.py]"]
  node_supabase[("Supabase data<br/>[supabase.py]")]
  node_integrations["Messaging integrations"]
end

node_customer(("Customer"))
node_supplier(("Supplier"))

node_customer -.->|"uses"| node_customer_app
node_supplier -.->|"uses"| node_supplier_app
node_customer_app -.->|"opens restock"| node_restock_flow
node_restock_flow -->|"searches suppliers"| node_suppliers_api
node_restock_flow -->|"generates message"| node_orders_api
node_restock_flow -->|"saves draft"| node_draft_store
node_orders_api -->|"sends requests"| node_api_client
node_suppliers_api -->|"sends requests"| node_api_client
node_customer_app -.->|"calls backend"| node_api_client
node_supplier_app -.->|"calls backend"| node_api_client
node_auth_app -.->|"uses session"| node_auth_state
node_api_client -.->|"HTTP requests"| node_customer_routes
node_api_client -.->|"HTTP requests"| node_supplier_routes
node_customer_routes -->|"calls stock service"| node_stock_service
node_customer_routes -->|"calls upload service"| node_upload_service
node_customer_routes -->|"calls order service"| node_ordering_service
node_supplier_routes -.->|"uses data"| node_supabase
node_shared_routes -.->|"requires identity"| node_identity
node_customer_routes -->|"role-gated"| node_identity
node_supplier_routes -->|"role-gated"| node_identity
node_ordering_service -.->|"reads and writes"| node_supabase
node_stock_service -.->|"reads and writes"| node_supabase
node_upload_service -.->|"reads and writes"| node_supabase
node_jobs -.->|"recalculates"| node_ml
node_customer_routes -.->|"uses rules"| node_domain_rules
node_ordering_service -.->|"sends messages"| node_integrations

click node_customer_app "https://github.com/pulindu-theekshana/inventix/tree/main/frontend/app/(customer)"
click node_supplier_app "https://github.com/pulindu-theekshana/inventix/tree/main/frontend/app/(supplier)"
click node_auth_app "https://github.com/pulindu-theekshana/inventix/tree/main/frontend/app/(auth)"
click node_restock_flow "https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/hooks/useOpenRestock.ts"
click node_draft_store "https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/stores/restockDraftStore.ts"
click node_api_client "https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/api/client.ts"
click node_orders_api "https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/api/ordering.ts"
click node_suppliers_api "https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/api/suppliers.ts"
click node_auth_state "https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/stores/authStore.ts"
click node_customer_routes "https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/feeds/customer"
click node_supplier_routes "https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/feeds/supplier"
click node_shared_routes "https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/feeds/shared"
click node_ordering_service "https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/feeds/customer/ordering/service.py"
click node_stock_service "https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/feeds/customer/stocks/service.py"
click node_upload_service "https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/feeds/customer/uploads/service.py"
click node_domain_rules "https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/domain"
click node_ml "https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/ml"
click node_jobs "https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/jobs"
click node_identity "https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/dependencies.py"
click node_supabase "https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/core/supabase.py"
click node_integrations "https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/integrations"

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_customer_app,node_supplier_app,node_auth_app,node_restock_flow,node_draft_store,node_api_client,node_orders_api,node_suppliers_api,node_auth_state toneBlue
class node_customer_routes,node_supplier_routes,node_shared_routes toneAmber
class node_ordering_service,node_stock_service,node_upload_service,node_domain_rules,node_ml toneMint
class node_jobs,node_identity,node_supabase,node_integrations toneRose
class node_customer,node_supplier toneIndigo
```

## Components

### Mobile app

- [Customer screens](https://github.com/pulindu-theekshana/inventix/tree/main/frontend/app/(customer)): `frontend/app/(customer)`
- [Supplier screens](https://github.com/pulindu-theekshana/inventix/tree/main/frontend/app/(supplier)): `frontend/app/(supplier)`
- [Sign-in screens](https://github.com/pulindu-theekshana/inventix/tree/main/frontend/app/(auth)): `frontend/app/(auth)`
- [Restock flow](https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/hooks/useOpenRestock.ts): `frontend/src/hooks/useOpenRestock.ts`
- [Restock draft](https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/stores/restockDraftStore.ts): `frontend/src/stores/restockDraftStore.ts`
- [HTTP client](https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Ordering API](https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/api/ordering.ts): `frontend/src/api/ordering.ts`
- [Supplier API](https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/api/suppliers.ts): `frontend/src/api/suppliers.ts`
- [Auth state](https://github.com/pulindu-theekshana/inventix/blob/main/frontend/src/stores/authStore.ts): `frontend/src/stores/authStore.ts`

### Backend feeds

- [Customer routes](https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/feeds/customer): `backend/app/feeds/customer`
- [Supplier routes](https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/feeds/supplier): `backend/app/feeds/supplier`
- [Shared routes](https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/feeds/shared): `backend/app/feeds/shared`

### Business logic

- [Order handling](https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/feeds/customer/ordering/service.py): `backend/app/feeds/customer/ordering/service.py`
- [Stock handling](https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/feeds/customer/stocks/service.py): `backend/app/feeds/customer/stocks/service.py`
- [Stock uploads](https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/feeds/customer/uploads/service.py): `backend/app/feeds/customer/uploads/service.py`
- [Inventory and order rules](https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/domain): `backend/app/domain`
- [Forecasting and ranking](https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/ml): `backend/app/ml`

### Data and jobs

- [Scheduled jobs](https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/jobs): `backend/app/jobs`
- [Auth and role checks](https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/dependencies.py): `backend/app/dependencies.py`
- [Supabase data](https://github.com/pulindu-theekshana/inventix/blob/main/backend/app/core/supabase.py): `backend/app/core/supabase.py`
- [Messaging integrations](https://github.com/pulindu-theekshana/inventix/tree/main/backend/app/integrations): `backend/app/integrations`

### Other components

- **Customer**
- **Supplier**

## Connections

- Customer → Customer screens: uses (evidence: `README.md`)
- Supplier → Supplier screens: uses (evidence: `README.md`)
- Customer screens → Restock flow: opens restock (evidence: `frontend/app/(customer)/stocks/index.tsx`)
- Restock flow → Supplier API: searches suppliers (evidence: `frontend/src/hooks/useOpenRestock.ts`)
- Restock flow → Ordering API: generates message (evidence: `frontend/src/hooks/useOpenRestock.ts`)
- Restock flow → Restock draft: saves draft (evidence: `frontend/src/hooks/useOpenRestock.ts`)
- Ordering API → HTTP client: sends requests (evidence: `frontend/src/api/ordering.ts`)
- Supplier API → HTTP client: sends requests
- Customer screens → HTTP client: calls backend (evidence: `README.md`)
- Supplier screens → HTTP client: calls backend (evidence: `README.md`)
- Sign-in screens → Auth state: uses session
- HTTP client → Customer routes: HTTP requests (evidence: `README.md`)
- HTTP client → Supplier routes: HTTP requests (evidence: `README.md`)
- Customer routes → Stock handling: calls stock service (evidence: `backend/app/feeds/customer/stocks/routes.py`)
- Customer routes → Stock uploads: calls upload service (evidence: `backend/app/feeds/customer/uploads/routes.py`)
- Customer routes → Order handling: calls order service (evidence: `backend/app/feeds/customer/ordering/routes.py`)
- Supplier routes → Supabase data: uses data
- Shared routes → Auth and role checks: requires identity (evidence: `backend/app/dependencies.py`)
- Customer routes → Auth and role checks: role-gated (evidence: `backend/app/dependencies.py`)
- Supplier routes → Auth and role checks: role-gated (evidence: `backend/app/dependencies.py`)
- Order handling → Supabase data: reads and writes
- Stock handling → Supabase data: reads and writes
- Stock uploads → Supabase data: reads and writes
- Scheduled jobs → Forecasting and ranking: recalculates
- Customer routes → Inventory and order rules: uses rules
- Order handling → Messaging integrations: sends messages
