# muthaa/asiriapos architecture

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

- Interactive diagram: https://gitdiagram.com/muthaa/asiriapos
- Repository: https://github.com/muthaa/asiriapos

## Overview

AsiriaPOS is a Django POS backend whose main flow is staff authentication followed by API-driven checkout: checkout creates a sale and its lines, while sale signals record stock movement. The wider product includes stock control, purchasing/receiving, customer and business records, returns/refunds, cash sessions, split payments, and audit logging. The README also advertises analytics, M-Pesa, multi-location stock, and reservations; some of those implementation paths are not present in the sampled excerpts, so their links are documented or left unverified rather than inferred from names. Evidence is limited to the supplied README, SOURCE INDEX, and excerpts.

Main entry points: [`AsiriaPOS/urls.py`](https://github.com/muthaa/asiriapos/blob/main/AsiriaPOS/urls.py) (API routes), [`sales/views.py`](https://github.com/muthaa/asiriapos/blob/main/sales/views.py) (Sales operations), [`products/models.py`](https://github.com/muthaa/asiriapos/blob/main/products/models.py) (Stock control), [`sales/models.py`](https://github.com/muthaa/asiriapos/blob/main/sales/models.py) (Sales records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access &amp; API"]
  node_api["API routes<br/>[urls.py]"]
  node_auth["Authentication<br/>[views.py]"]
  node_users[("Business users<br/>[models.py]")]
end

subgraph group_commerce["Sales &amp; Payments"]
  node_checkout["Checkout &amp; receipts<br/>[views.py]"]
  node_sales[("Sales records<br/>[models.py]")]
  node_sales_api["Sales operations<br/>[views.py]"]
  node_cash[("Cash &amp; payments<br/>[models.py]")]
  node_returns[("Returns &amp; refunds<br/>[models.py]")]
  node_analytics["Sales analytics<br/>[views.py]"]
end

subgraph group_inventory["Inventory"]
  node_products_api["Product operations<br/>[views.py]"]
  node_stock[("Stock control<br/>[models.py]")]
  node_reservations[("Stock reservations<br/>[models.py]")]
end

subgraph group_operations["Purchasing &amp; Registry"]
  node_purchasing["Purchase &amp; receiving<br/>[views.py]"]
  node_purchase_records[("Purchase records<br/>[models.py]")]
  node_registry_api["Registry operations<br/>[views.py]"]
  node_registry[("Customers &amp; suppliers<br/>[models.py]")]
end

subgraph group_governance["Security &amp; Audit"]
  node_permissions["Role permissions<br/>[permissions.py]"]
  node_audit[("Audit log<br/>[models.py]")]
end

node_staff(("POS staff"))
node_mpesa["M-Pesa API"]

node_staff -->|"calls API"| node_api
node_api -->|"routes auth"| node_auth
node_api -->|"routes checkout"| node_checkout
node_api -->|"routes sales"| node_sales_api
node_api -->|"routes products"| node_products_api
node_api -->|"routes purchases"| node_purchasing
node_api -->|"routes registry"| node_registry_api
node_auth -->|"looks up user"| node_users
node_checkout -->|"creates sale lines"| node_sales
node_checkout -->|"loads products"| node_stock
node_sales -->|"records stock movement"| node_stock
node_sales_api -->|"manages sales"| node_sales
node_sales_api -->|"logs voids"| node_audit
node_sales_api -->|"creates payments"| node_cash
node_sales_api -->|"manages returns"| node_returns
node_sales_api -->|"creates reservations"| node_reservations
node_products_api -->|"manages stock"| node_stock
node_purchasing -->|"creates purchase"| node_purchase_records
node_purchasing -->|"records audit"| node_audit
node_registry_api -->|"manages registry"| node_registry
node_analytics -.->|"reports on sales"| node_sales
node_mpesa -.->|"mobile payment"| node_cash
node_sales_api -.->|"checks access"| node_permissions
node_stock -.->|"supports locations"| node_stock

click node_api "https://github.com/muthaa/asiriapos/blob/main/AsiriaPOS/urls.py"
click node_auth "https://github.com/muthaa/asiriapos/blob/main/authentication/views.py"
click node_users "https://github.com/muthaa/asiriapos/blob/main/users/models.py"
click node_permissions "https://github.com/muthaa/asiriapos/blob/main/authentication/permissions.py"
click node_checkout "https://github.com/muthaa/asiriapos/blob/main/sales_views/views.py"
click node_sales "https://github.com/muthaa/asiriapos/blob/main/sales/models.py"
click node_sales_api "https://github.com/muthaa/asiriapos/blob/main/sales/views.py"
click node_cash "https://github.com/muthaa/asiriapos/blob/main/sales/models.py"
click node_returns "https://github.com/muthaa/asiriapos/blob/main/sales/models.py"
click node_products_api "https://github.com/muthaa/asiriapos/blob/main/products/views.py"
click node_stock "https://github.com/muthaa/asiriapos/blob/main/products/models.py"
click node_reservations "https://github.com/muthaa/asiriapos/blob/main/sales/models.py"
click node_purchasing "https://github.com/muthaa/asiriapos/blob/main/purchases/views.py"
click node_purchase_records "https://github.com/muthaa/asiriapos/blob/main/purchases/models.py"
click node_registry_api "https://github.com/muthaa/asiriapos/blob/main/registry/views.py"
click node_registry "https://github.com/muthaa/asiriapos/blob/main/registry/models.py"
click node_audit "https://github.com/muthaa/asiriapos/blob/main/Domain/models.py"
click node_analytics "https://github.com/muthaa/asiriapos/blob/main/sales/views.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_api,node_auth,node_users toneBlue
class node_checkout,node_sales,node_sales_api,node_cash,node_returns,node_analytics toneAmber
class node_products_api,node_stock,node_reservations,node_mpesa toneMint
class node_purchasing,node_purchase_records,node_registry_api,node_registry toneRose
class node_permissions,node_audit,node_staff toneIndigo
```

## Components

### Access & API

- [API routes](https://github.com/muthaa/asiriapos/blob/main/AsiriaPOS/urls.py): `AsiriaPOS/urls.py`
- [Authentication](https://github.com/muthaa/asiriapos/blob/main/authentication/views.py): `authentication/views.py`
- [Business users](https://github.com/muthaa/asiriapos/blob/main/users/models.py): `users/models.py`

### Sales & Payments

- [Checkout & receipts](https://github.com/muthaa/asiriapos/blob/main/sales_views/views.py): `sales_views/views.py`
- [Sales records](https://github.com/muthaa/asiriapos/blob/main/sales/models.py): `sales/models.py`
- [Sales operations](https://github.com/muthaa/asiriapos/blob/main/sales/views.py): `sales/views.py`
- [Cash & payments](https://github.com/muthaa/asiriapos/blob/main/sales/models.py): `sales/models.py`
- [Returns & refunds](https://github.com/muthaa/asiriapos/blob/main/sales/models.py): `sales/models.py`
- [Sales analytics](https://github.com/muthaa/asiriapos/blob/main/sales/views.py): `sales/views.py`

### Inventory

- [Product operations](https://github.com/muthaa/asiriapos/blob/main/products/views.py): `products/views.py`
- [Stock control](https://github.com/muthaa/asiriapos/blob/main/products/models.py): `products/models.py`
- [Stock reservations](https://github.com/muthaa/asiriapos/blob/main/sales/models.py): `sales/models.py`

### Purchasing & Registry

- [Purchase & receiving](https://github.com/muthaa/asiriapos/blob/main/purchases/views.py): `purchases/views.py`
- [Purchase records](https://github.com/muthaa/asiriapos/blob/main/purchases/models.py): `purchases/models.py`
- [Registry operations](https://github.com/muthaa/asiriapos/blob/main/registry/views.py): `registry/views.py`
- [Customers & suppliers](https://github.com/muthaa/asiriapos/blob/main/registry/models.py): `registry/models.py`

### Security & Audit

- [Role permissions](https://github.com/muthaa/asiriapos/blob/main/authentication/permissions.py): `authentication/permissions.py`
- [Audit log](https://github.com/muthaa/asiriapos/blob/main/Domain/models.py): `Domain/models.py`

### Other components

- **POS staff**
- **M-Pesa API**

## Connections

- POS staff → API routes: calls API (evidence: `AsiriaPOS/urls.py`)
- API routes → Authentication: routes auth (evidence: `AsiriaPOS/urls.py`)
- API routes → Checkout & receipts: routes checkout (evidence: `AsiriaPOS/urls.py`)
- API routes → Sales operations: routes sales (evidence: `AsiriaPOS/urls.py`)
- API routes → Product operations: routes products (evidence: `AsiriaPOS/urls.py`)
- API routes → Purchase & receiving: routes purchases (evidence: `AsiriaPOS/urls.py`)
- API routes → Registry operations: routes registry (evidence: `AsiriaPOS/urls.py`)
- Authentication → Business users: looks up user (evidence: `authentication/views.py`)
- Checkout & receipts → Sales records: creates sale lines (evidence: `sales_views/views.py`)
- Checkout & receipts → Stock control: loads products (evidence: `sales_views/views.py`)
- Sales records → Stock control: records stock movement (evidence: `sales/models.py`)
- Sales operations → Sales records: manages sales (evidence: `sales/views.py`)
- Sales operations → Audit log: logs voids (evidence: `sales/views.py`)
- Sales operations → Cash & payments: creates payments (evidence: `sales/views.py`)
- Sales operations → Returns & refunds: manages returns (evidence: `sales/views.py`)
- Sales operations → Stock reservations: creates reservations (evidence: `sales/views.py`)
- Product operations → Stock control: manages stock (evidence: `products/views.py`)
- Purchase & receiving → Purchase records: creates purchase (evidence: `purchases/views.py`)
- Purchase & receiving → Audit log: records audit (evidence: `purchases/views.py`)
- Registry operations → Customers & suppliers: manages registry (evidence: `registry/views.py`)
- Sales analytics → Sales records: reports on sales (evidence: `sales/views.py`)
- M-Pesa API → Cash & payments: mobile payment
- Sales operations → Role permissions: checks access (evidence: `sales/views.py`)
- Stock control → Stock control: supports locations (evidence: `products/models.py`)
