# hyangwoosh/leaptron-warehouse-management-system architecture

> Architecture diagram of the GitHub repository hyangwoosh/leaptron-warehouse-management-system, 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/hyangwoosh/leaptron-warehouse-management-system
- Repository: https://github.com/hyangwoosh/leaptron-warehouse-management-system

## Overview

This is a web-based inventory and operations system: staff manage products and bin locations, process RMAs and tool loans, and administer users, groups, and notifications. The client routes authenticated users to these workflows; the API serves routed controllers, which delegate domain operations to services and use database and cache configuration. The excerpts establish several API call chains, but provide little evidence for most client-to-API wiring or external notification delivery, so those links are omitted rather than inferred.

Main entry points: [`client/src/App.tsx`](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/App.tsx) (Route shell), [`api/src/controllers/rma.controller.js`](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/rma.controller.js) (RMA workflow controller), [`api/src/controllers/tLoanController.js`](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/tLoanController.js) (Loan workflow controller), [`api/src/controllers/userController.js`](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/userController.js) (User and login controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Staff web client"]
  node_app["Route shell<br/>[App.tsx]"]
  node_authpage["Login and MFA"]
  node_rmapage["RMA workflow<br/>[NewRma.tsx]"]
  node_loanpage["Tool-loan workflow<br/>[NewtToan.tsx]"]
  node_rma_view["RMA display<br/>[RmaDisplay.tsx]"]
  node_loan_view["Loan display<br/>[TloanDisplay.tsx]"]
  node_client_state["Client state<br/>[store.tsx]"]
  node_user_slice["Current-user state"]
  node_sidebar_slice["Navigation state<br/>[SidebarSlice.ts]"]
  node_client_config["API configuration<br/>[config.ts]"]
end

subgraph group_api["API and workflows"]
  node_api_entry["HTTP and socket server<br/>[index.js]"]
  node_routes["API routes<br/>[index.js]"]
  node_rma_routes["RMA routes<br/>[rma.route.js]"]
  node_rma_controller["RMA workflow controller<br/>[rma.controller.js]"]
  node_rma_service["RMA operations<br/>[rma.service.js]"]
  node_loan_routes["Loan routes<br/>[tLoanRoutes.js]"]
  node_loan_controller["Loan workflow controller<br/>[tLoanController.js]"]
  node_loan_service["Loan operations<br/>[tLoanService.js]"]
  node_product_controller["Product updates"]
  node_email_controller["Email notifications"]
  node_telegram_controller["Telegram notifications"]
end

subgraph group_identity["Identity and access"]
  node_user_routes["User routes<br/>[userRoutes.js]"]
  node_user_controller["User and login controller<br/>[userController.js]"]
  node_user_service["User operations<br/>[userService.js]"]
  node_group_service["Notification-group operations"]
  node_validation["Request validation<br/>[validation.js]"]
end

subgraph group_runtime["Runtime infrastructure"]
  node_cache_config["Cache client<br/>[caching.js]"]
  node_database_config["Database connection<br/>[database.js]"]
  node_redis[("Redis")]
  node_sql_store[("SQL database")]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_authpage
node_app -->|"routes to"| node_rmapage
node_app -->|"routes to"| node_loanpage
node_app -->|"renders"| node_rma_view
node_app -->|"renders"| node_loan_view
node_authpage -->|"dispatches to"| node_user_slice
node_authpage -->|"dispatches to"| node_sidebar_slice
node_app -->|"checks auth"| node_user_slice
node_api_entry -->|"mounts"| node_routes
node_routes -.->|"registers"| node_rma_routes
node_routes -.->|"registers"| node_loan_routes
node_rma_routes -.->|"routes to"| node_rma_controller
node_loan_routes -->|"routes to"| node_loan_controller
node_user_routes -->|"routes to"| node_user_controller
node_user_routes -->|"applies"| node_validation
node_loan_routes -->|"applies"| node_validation
node_rma_controller -->|"calls"| node_rma_service
node_loan_controller -->|"calls"| node_loan_service
node_loan_controller -->|"calls"| node_email_controller
node_rma_controller -->|"calls"| node_email_controller
node_rma_controller -->|"calls"| node_telegram_controller
node_loan_controller -->|"calls"| node_telegram_controller
node_user_controller -->|"calls"| node_user_service
node_user_controller -->|"calls"| node_group_service
node_user_controller -->|"reads and writes"| node_cache_config
node_rma_controller -->|"reads and writes"| node_cache_config
node_loan_controller -->|"reads and writes"| node_cache_config
node_cache_config -->|"connects"| node_redis
node_rma_service -->|"uses"| node_database_config
node_loan_service -->|"uses"| node_database_config
node_user_service -->|"uses"| node_database_config
node_database_config -.->|"connects"| node_sql_store
node_api_entry -->|"dispatches MQTT updates"| node_product_controller

click node_app "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/App.tsx"
click node_authpage "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/pages/auth/MultiFactorAuthentication.tsx"
click node_rmapage "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/pages/rma/NewRma.tsx"
click node_loanpage "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/pages/tloans/NewtToan.tsx"
click node_rma_view "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/components/display/RmaDisplay.tsx"
click node_loan_view "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/components/display/TloanDisplay.tsx"
click node_client_state "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/app/store.tsx"
click node_user_slice "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/app/reducers/CurrentUserSlice.ts"
click node_sidebar_slice "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/app/reducers/SidebarSlice.ts"
click node_client_config "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/config/config.ts"
click node_api_entry "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/index.js"
click node_routes "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/routes/index.js"
click node_rma_routes "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/routes/rma.route.js"
click node_rma_controller "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/rma.controller.js"
click node_rma_service "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/services/rma.service.js"
click node_loan_routes "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/routes/tLoanRoutes.js"
click node_loan_controller "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/tLoanController.js"
click node_loan_service "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/services/tLoanService.js"
click node_product_controller "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/productController.js"
click node_user_routes "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/routes/userRoutes.js"
click node_user_controller "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/userController.js"
click node_user_service "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/services/userService.js"
click node_group_service "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/services/notificationGroupService.js"
click node_validation "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/middlewares/validation.js"
click node_email_controller "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/emailNotificationController.js"
click node_telegram_controller "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/telegramNotificationController.js"
click node_cache_config "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/config/caching.js"
click node_database_config "https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/config/database.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_app,node_authpage,node_rmapage,node_loanpage,node_rma_view,node_loan_view,node_client_state,node_user_slice,node_sidebar_slice,node_client_config,node_staff toneBlue
class node_api_entry,node_routes,node_rma_routes,node_rma_controller,node_rma_service,node_loan_routes,node_loan_controller,node_loan_service,node_product_controller,node_email_controller,node_telegram_controller toneAmber
class node_user_routes,node_user_controller,node_user_service,node_group_service,node_validation toneMint
class node_cache_config,node_database_config,node_redis,node_sql_store toneRose
```

## Components

### Staff web client

- [Route shell](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Login and MFA](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/pages/auth/MultiFactorAuthentication.tsx): `client/src/pages/auth/MultiFactorAuthentication.tsx`
- [RMA workflow](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/pages/rma/NewRma.tsx): `client/src/pages/rma/NewRma.tsx`
- [Tool-loan workflow](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/pages/tloans/NewtToan.tsx): `client/src/pages/tloans/NewtToan.tsx`
- [RMA display](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/components/display/RmaDisplay.tsx): `client/src/components/display/RmaDisplay.tsx`
- [Loan display](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/components/display/TloanDisplay.tsx): `client/src/components/display/TloanDisplay.tsx`
- [Client state](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/app/store.tsx): `client/src/app/store.tsx`
- [Current-user state](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/app/reducers/CurrentUserSlice.ts): `client/src/app/reducers/CurrentUserSlice.ts`
- [Navigation state](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/app/reducers/SidebarSlice.ts): `client/src/app/reducers/SidebarSlice.ts`
- [API configuration](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/client/src/config/config.ts): `client/src/config/config.ts`

### API and workflows

- [HTTP and socket server](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/index.js): `api/index.js`
- [API routes](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/routes/index.js): `api/src/routes/index.js`
- [RMA routes](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/routes/rma.route.js): `api/src/routes/rma.route.js`
- [RMA workflow controller](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/rma.controller.js): `api/src/controllers/rma.controller.js`
- [RMA operations](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/services/rma.service.js): `api/src/services/rma.service.js`
- [Loan routes](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/routes/tLoanRoutes.js): `api/src/routes/tLoanRoutes.js`
- [Loan workflow controller](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/tLoanController.js): `api/src/controllers/tLoanController.js`
- [Loan operations](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/services/tLoanService.js): `api/src/services/tLoanService.js`
- [Product updates](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/productController.js): `api/src/controllers/productController.js`
- [Email notifications](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/emailNotificationController.js): `api/src/controllers/emailNotificationController.js`
- [Telegram notifications](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/telegramNotificationController.js): `api/src/controllers/telegramNotificationController.js`

### Identity and access

- [User routes](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/routes/userRoutes.js): `api/src/routes/userRoutes.js`
- [User and login controller](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/controllers/userController.js): `api/src/controllers/userController.js`
- [User operations](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/services/userService.js): `api/src/services/userService.js`
- [Notification-group operations](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/services/notificationGroupService.js): `api/src/services/notificationGroupService.js`
- [Request validation](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/middlewares/validation.js): `api/src/middlewares/validation.js`

### Runtime infrastructure

- [Cache client](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/config/caching.js): `api/src/config/caching.js`
- [Database connection](https://github.com/hyangwoosh/leaptron-warehouse-management-system/blob/main/api/src/config/database.js): `api/src/config/database.js`
- **Redis**
- **SQL database**

### Other components

- **Staff user**

## Connections

- Staff user → Route shell: uses (evidence: `client/src/App.tsx`)
- Route shell → Login and MFA: routes to (evidence: `client/src/App.tsx`)
- Route shell → RMA workflow: routes to (evidence: `client/src/App.tsx`)
- Route shell → Tool-loan workflow: routes to (evidence: `client/src/App.tsx`)
- Route shell → RMA display: renders (evidence: `client/src/App.tsx`)
- Route shell → Loan display: renders (evidence: `client/src/App.tsx`)
- Login and MFA → Current-user state: dispatches to (evidence: `client/src/pages/auth/MultiFactorAuthentication.tsx`)
- Login and MFA → Navigation state: dispatches to (evidence: `client/src/pages/auth/MultiFactorAuthentication.tsx`)
- Route shell → Current-user state: checks auth (evidence: `client/src/App.tsx`)
- HTTP and socket server → API routes: mounts (evidence: `api/index.js`)
- API routes → RMA routes: registers
- API routes → Loan routes: registers
- RMA routes → RMA workflow controller: routes to
- Loan routes → Loan workflow controller: routes to (evidence: `api/src/routes/tLoanRoutes.js`)
- User routes → User and login controller: routes to (evidence: `api/src/routes/userRoutes.js`)
- User routes → Request validation: applies (evidence: `api/src/routes/userRoutes.js`)
- Loan routes → Request validation: applies (evidence: `api/src/routes/tLoanRoutes.js`)
- RMA workflow controller → RMA operations: calls (evidence: `api/src/controllers/rma.controller.js`)
- Loan workflow controller → Loan operations: calls (evidence: `api/src/controllers/tLoanController.js`)
- Loan workflow controller → Email notifications: calls (evidence: `api/src/controllers/tLoanController.js`)
- RMA workflow controller → Email notifications: calls (evidence: `api/src/controllers/rma.controller.js`)
- RMA workflow controller → Telegram notifications: calls (evidence: `api/src/controllers/rma.controller.js`)
- Loan workflow controller → Telegram notifications: calls (evidence: `api/src/controllers/tLoanController.js`)
- User and login controller → User operations: calls (evidence: `api/src/controllers/userController.js`)
- User and login controller → Notification-group operations: calls (evidence: `api/src/controllers/userController.js`)
- User and login controller → Cache client: reads and writes (evidence: `api/src/controllers/userController.js`)
- RMA workflow controller → Cache client: reads and writes (evidence: `api/src/controllers/rma.controller.js`)
- Loan workflow controller → Cache client: reads and writes (evidence: `api/src/controllers/tLoanController.js`)
- Cache client → Redis: connects (evidence: `api/src/config/caching.js`)
- RMA operations → Database connection: uses (evidence: `api/src/services/rma.service.js`)
- Loan operations → Database connection: uses (evidence: `api/src/services/tLoanService.js`)
- User operations → Database connection: uses (evidence: `api/src/services/userService.js`)
- Database connection → SQL database: connects
- HTTP and socket server → Product updates: dispatches MQTT updates (evidence: `api/index.js`)
