# gamindukalmadu/techloom-intern-assessment architecture

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

- Interactive diagram: https://gitdiagram.com/gamindukalmadu/techloom-intern-assessment
- Repository: https://github.com/gamindukalmadu/techloom-intern-assessment

## Overview

The tree contains two related but separate POS/commerce applications: task-01 is a cashier-facing POS with inventory, checkout, payments, reporting, and settings; task-02 is a customer storefront with admin operations, reserved-stock checkout, payment, and refunds. The maps show their distinct UI/API boundaries and the evidenced backend workflow. Source sampling is incomplete, and the empty README provides no additional capability or relationship evidence; unsampled feature branches are represented only where the tree establishes them.

Main entry points: [`task-02/backend/src/controllers/admin.controller.js`](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/controllers/admin.controller.js) (Admin operations), [`task-01/pos-order-inventory-system/frontend/src/App.jsx`](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/App.jsx) (POS routes and context), [`task-02/backend/src/controllers/payment.controller.js`](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/controllers/payment.controller.js) (Checkout and payment), [`task-02/backend/src/models/Product.js`](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Product.js) (Products and stock)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_t1ui["POS interface"]
  node_pos_app["POS routes and context<br/>[App.jsx]"]
  node_pos_checkout["Cart and checkout<br/>[Checkout.jsx]"]
  node_pos_inventory["Inventory management<br/>[Inventory.jsx]"]
  node_pos_dashboard["Dashboard and reports<br/>[Dashboard.jsx]"]
  node_pos_payment["Payment workflow<br/>[Payment.jsx]"]
end

subgraph group_t1api["POS API"]
  node_pos_api["POS HTTP API<br/>[app.js]"]
  node_pos_product_routes["Product endpoints<br/>[product.routes.js]"]
  node_pos_product_controller["Product operations"]
  node_pos_cart_controller["Cart operations<br/>[cart.controller.js]"]
  node_pos_report_controller["Report operations"]
  node_pos_auth["Authentication service<br/>[auth.service.js]"]
end

subgraph group_t2ui["Storefront interface"]
  node_storefront["Storefront pages<br/>[page.js]"]
  node_store_auth_service["Account API client<br/>[authService.js]"]
  node_store_api_client["Frontend API client<br/>[api.js]"]
end

subgraph group_t2api["Storefront API"]
  node_store_api["Commerce HTTP API<br/>[app.js]"]
  node_store_product_routes["Product endpoints<br/>[product.routes.js]"]
  node_store_product_controller["Catalog operations"]
  node_store_admin_controller["Admin operations"]
  node_store_payment_controller["Checkout and payment"]
  node_reservation_worker["Reservation expiry"]
end

subgraph group_t2state["Commerce records"]
  node_order_record[("Orders<br/>[Order.js]")]
  node_product_record[("Products and stock<br/>[Product.js]")]
  node_reservation_record[("Reservations<br/>[Reservation.js]")]
  node_payment_record[("Payments<br/>[Payment.js]")]
  node_refund_record[("Refunds<br/>[Refund.js]")]
  node_store_category[("Categories<br/>[Category.js]")]
end

node_cashier(("Cashier"))
node_shopper(("Shopper or admin"))

node_cashier -->|"uses"| node_pos_app
node_pos_app -->|"routes to"| node_pos_checkout
node_pos_app -->|"routes to"| node_pos_inventory
node_pos_app -->|"routes to"| node_pos_dashboard
node_pos_app -->|"routes to"| node_pos_payment
node_pos_api -->|"mounts"| node_pos_product_routes
node_pos_product_routes -->|"dispatches"| node_pos_product_controller
node_pos_cart_controller --> node_pos_report_controller
node_pos_auth -.-> node_pos_api
node_shopper -->|"uses"| node_storefront
node_store_auth_service -->|"calls"| node_store_api_client
node_store_api -->|"mounts routes"| node_store_product_routes
node_store_product_routes -->|"dispatches"| node_store_product_controller
node_store_product_controller -->|"reads and writes"| node_product_record
node_store_product_controller -->|"queries"| node_store_category
node_store_admin_controller -->|"aggregates"| node_product_record
node_store_admin_controller -->|"aggregates"| node_order_record
node_store_admin_controller -->|"queries"| node_payment_record
node_store_admin_controller -->|"queries"| node_refund_record
node_store_admin_controller -->|"queries"| node_reservation_record
node_store_payment_controller -->|"updates"| node_order_record
node_store_payment_controller -->|"updates"| node_reservation_record
node_store_payment_controller -->|"adjusts stock"| node_product_record
node_store_payment_controller -->|"creates and reads"| node_payment_record
node_reservation_worker -->|"expires"| node_reservation_record
node_reservation_worker -->|"updates"| node_order_record
node_reservation_worker -->|"releases stock"| node_product_record

click node_pos_app "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/App.jsx"
click node_pos_checkout "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/pages/Checkout.jsx"
click node_pos_inventory "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/pages/Inventory.jsx"
click node_pos_dashboard "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/pages/Dashboard.jsx"
click node_pos_payment "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/pages/Payment.jsx"
click node_pos_api "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/app.js"
click node_pos_product_routes "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/routes/product.routes.js"
click node_pos_product_controller "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/controllers/product.controller.js"
click node_pos_cart_controller "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/controllers/cart.controller.js"
click node_pos_report_controller "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/controllers/report.controller.js"
click node_pos_auth "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/services/auth.service.js"
click node_storefront "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/frontend/app/page.js"
click node_store_auth_service "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/frontend/services/authService.js"
click node_store_api_client "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/frontend/services/api.js"
click node_store_api "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/app.js"
click node_store_product_routes "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/routes/product.routes.js"
click node_store_product_controller "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/controllers/product.controller.js"
click node_store_admin_controller "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/controllers/admin.controller.js"
click node_store_payment_controller "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/controllers/payment.controller.js"
click node_reservation_worker "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/services/reservationExpiry.service.js"
click node_order_record "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Order.js"
click node_product_record "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Product.js"
click node_reservation_record "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Reservation.js"
click node_payment_record "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Payment.js"
click node_refund_record "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Refund.js"
click node_store_category "https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Category.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_pos_app,node_pos_checkout,node_pos_inventory,node_pos_dashboard,node_pos_payment toneBlue
class node_pos_api,node_pos_product_routes,node_pos_product_controller,node_pos_cart_controller,node_pos_report_controller,node_pos_auth toneAmber
class node_storefront,node_store_auth_service,node_store_api_client toneMint
class node_store_api,node_store_product_routes,node_store_product_controller,node_store_admin_controller,node_store_payment_controller,node_reservation_worker toneRose
class node_order_record,node_product_record,node_reservation_record,node_payment_record,node_refund_record,node_store_category,node_cashier,node_shopper toneIndigo
```

## Components

### POS interface

- [POS routes and context](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/App.jsx): `task-01/pos-order-inventory-system/frontend/src/App.jsx`
- [Cart and checkout](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/pages/Checkout.jsx): `task-01/pos-order-inventory-system/frontend/src/pages/Checkout.jsx`
- [Inventory management](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/pages/Inventory.jsx): `task-01/pos-order-inventory-system/frontend/src/pages/Inventory.jsx`
- [Dashboard and reports](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/pages/Dashboard.jsx): `task-01/pos-order-inventory-system/frontend/src/pages/Dashboard.jsx`
- [Payment workflow](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/frontend/src/pages/Payment.jsx): `task-01/pos-order-inventory-system/frontend/src/pages/Payment.jsx`

### POS API

- [POS HTTP API](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/app.js): `task-01/pos-order-inventory-system/backend/src/app.js`
- [Product endpoints](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/routes/product.routes.js): `task-01/pos-order-inventory-system/backend/src/routes/product.routes.js`
- [Product operations](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/controllers/product.controller.js): `task-01/pos-order-inventory-system/backend/src/controllers/product.controller.js`
- [Cart operations](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/controllers/cart.controller.js): `task-01/pos-order-inventory-system/backend/src/controllers/cart.controller.js`
- [Report operations](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/controllers/report.controller.js): `task-01/pos-order-inventory-system/backend/src/controllers/report.controller.js`
- [Authentication service](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-01/pos-order-inventory-system/backend/src/services/auth.service.js): `task-01/pos-order-inventory-system/backend/src/services/auth.service.js`

### Storefront interface

- [Storefront pages](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/frontend/app/page.js): `task-02/frontend/app/page.js`
- [Account API client](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/frontend/services/authService.js): `task-02/frontend/services/authService.js`
- [Frontend API client](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/frontend/services/api.js): `task-02/frontend/services/api.js`

### Storefront API

- [Commerce HTTP API](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/app.js): `task-02/backend/src/app.js`
- [Product endpoints](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/routes/product.routes.js): `task-02/backend/src/routes/product.routes.js`
- [Catalog operations](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/controllers/product.controller.js): `task-02/backend/src/controllers/product.controller.js`
- [Admin operations](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/controllers/admin.controller.js): `task-02/backend/src/controllers/admin.controller.js`
- [Checkout and payment](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/controllers/payment.controller.js): `task-02/backend/src/controllers/payment.controller.js`
- [Reservation expiry](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/services/reservationExpiry.service.js): `task-02/backend/src/services/reservationExpiry.service.js`

### Commerce records

- [Orders](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Order.js): `task-02/backend/src/models/Order.js`
- [Products and stock](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Product.js): `task-02/backend/src/models/Product.js`
- [Reservations](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Reservation.js): `task-02/backend/src/models/Reservation.js`
- [Payments](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Payment.js): `task-02/backend/src/models/Payment.js`
- [Refunds](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Refund.js): `task-02/backend/src/models/Refund.js`
- [Categories](https://github.com/gamindukalmadu/techloom-intern-assessment/blob/main/task-02/backend/src/models/Category.js): `task-02/backend/src/models/Category.js`

### Other components

- **Cashier**
- **Shopper or admin**

## Connections

- Cashier → POS routes and context: uses (evidence: `task-01/pos-order-inventory-system/frontend/src/App.jsx`)
- POS routes and context → Cart and checkout: routes to (evidence: `task-01/pos-order-inventory-system/frontend/src/App.jsx`)
- POS routes and context → Inventory management: routes to (evidence: `task-01/pos-order-inventory-system/frontend/src/App.jsx`)
- POS routes and context → Dashboard and reports: routes to (evidence: `task-01/pos-order-inventory-system/frontend/src/App.jsx`)
- POS routes and context → Payment workflow: routes to (evidence: `task-01/pos-order-inventory-system/frontend/src/App.jsx`)
- POS HTTP API → Product endpoints: mounts (evidence: `task-01/pos-order-inventory-system/backend/src/app.js`)
- Product endpoints → Product operations: dispatches (evidence: `task-01/pos-order-inventory-system/backend/src/routes/product.routes.js`)
- Cart operations → Report operations
- Authentication service → POS HTTP API
- Shopper or admin → Storefront pages: uses
- Account API client → Frontend API client: calls (evidence: `task-02/frontend/services/authService.js`)
- Commerce HTTP API → Product endpoints: mounts routes (evidence: `task-02/backend/src/app.js`)
- Product endpoints → Catalog operations: dispatches (evidence: `task-02/backend/src/routes/product.routes.js`)
- Catalog operations → Products and stock: reads and writes (evidence: `task-02/backend/src/controllers/product.controller.js`)
- Catalog operations → Categories: queries (evidence: `task-02/backend/src/controllers/product.controller.js`)
- Admin operations → Products and stock: aggregates (evidence: `task-02/backend/src/controllers/admin.controller.js`)
- Admin operations → Orders: aggregates (evidence: `task-02/backend/src/controllers/admin.controller.js`)
- Admin operations → Payments: queries (evidence: `task-02/backend/src/controllers/admin.controller.js`)
- Admin operations → Refunds: queries (evidence: `task-02/backend/src/controllers/admin.controller.js`)
- Admin operations → Reservations: queries (evidence: `task-02/backend/src/controllers/admin.controller.js`)
- Checkout and payment → Orders: updates (evidence: `task-02/backend/src/controllers/payment.controller.js`)
- Checkout and payment → Reservations: updates (evidence: `task-02/backend/src/controllers/payment.controller.js`)
- Checkout and payment → Products and stock: adjusts stock (evidence: `task-02/backend/src/controllers/payment.controller.js`)
- Checkout and payment → Payments: creates and reads (evidence: `task-02/backend/src/controllers/payment.controller.js`)
- Reservation expiry → Reservations: expires (evidence: `task-02/backend/src/services/reservationExpiry.service.js`)
- Reservation expiry → Orders: updates (evidence: `task-02/backend/src/services/reservationExpiry.service.js`)
- Reservation expiry → Products and stock: releases stock (evidence: `task-02/backend/src/services/reservationExpiry.service.js`)
