# mehedi-hasan-raju/garments-factory-erp-software architecture

> Architecture diagram of the GitHub repository mehedi-hasan-raju/garments-factory-erp-software, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mehedi-hasan-raju/garments-factory-erp-software
- Repository: https://github.com/mehedi-hasan-raju/garments-factory-erp-software

## Overview

This is a Garments ERP backend API. A client request enters the Express app, is routed to a domain endpoint, and—where the sampled controller shows the call—passes to domain services for validation and business operations. The major domains cover accounts, workforce and payroll, inventory, and purchasing. The source index identifies additional domain modules and their dependencies, but their implementation details were not sampled; those are represented at subsystem level, and only documented or indexed relationships are shown.

Main entry points: [`backend/src/app.ts`](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/app.ts) (Express app), [`backend/src/lib/prisma.ts`](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/lib/prisma.ts) (Prisma client), [`backend/src/modules/inventory/inventory.controller.ts`](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/inventory/inventory.controller.ts) (Stock operations), [`backend/src/modules/auth/auth.controller.ts`](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/auth/auth.controller.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_app["Express app<br/>[app.ts]"]
end

subgraph group_people["Accounts and workforce"]
  node_auth["Authentication<br/>[auth.controller.ts]"]
  node_users["User administration"]
  node_departments["Departments"]
  node_employees["Employees"]
  node_salary["Employee salary"]
  node_components["Salary components"]
  node_payroll["Payroll"]
end

subgraph group_stock["Inventory and catalog"]
  node_catalog["Product catalog"]
  node_categories["Product categories"]
  node_units["Units"]
  node_inventory["Stock operations"]
  node_warehouses["Warehouses"]
  node_locations["Warehouse locations"]
end

subgraph group_buy["Purchasing"]
  node_suppliers["Suppliers"]
  node_orders["Purchase orders"]
end

subgraph group_infra["Shared infrastructure"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_database[("PostgreSQL")]
end

node_client(("ERP client"))

node_client -->|"sends requests"| node_app
node_app -->|"mounts auth routes"| node_auth
node_app -->|"mounts user routes"| node_users
node_app -->|"mounts routes"| node_departments
node_app -->|"mounts routes"| node_employees
node_app -->|"mounts routes"| node_salary
node_app -->|"mounts routes"| node_components
node_app -->|"mounts routes"| node_payroll
node_app -->|"mounts routes"| node_catalog
node_app -->|"mounts routes"| node_categories
node_app -->|"mounts routes"| node_units
node_app -->|"mounts routes"| node_inventory
node_app -->|"mounts routes"| node_warehouses
node_app -->|"mounts routes"| node_locations
node_app -->|"mounts routes"| node_suppliers
node_app -->|"mounts routes"| node_orders
node_auth -->|"reads and writes via repository"| node_prisma
node_inventory -->|"uses repository and client"| node_prisma
node_orders -->|"repository uses client"| node_prisma
node_prisma -->|"connects through adapter"| node_database
node_inventory -.->|"persists stock operations"| node_database

click node_app "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/app.ts"
click node_auth "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/auth/auth.controller.ts"
click node_users "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/users"
click node_departments "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/departments/department.controller.ts"
click node_employees "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/employees/employee.controller.ts"
click node_salary "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/employees/employee-salary.controller.ts"
click node_components "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/salary-components"
click node_payroll "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/payrolls/payroll.controller.ts"
click node_catalog "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/products"
click node_categories "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/product-categories"
click node_units "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/units"
click node_inventory "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/inventory/inventory.controller.ts"
click node_warehouses "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/warehouses"
click node_locations "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/warehouse-locations"
click node_suppliers "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/suppliers"
click node_orders "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/purchase-orders/purchase-order.controller.ts"
click node_prisma "https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/lib/prisma.ts"

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_client toneBlue
class node_auth,node_users,node_departments,node_employees,node_salary,node_components,node_payroll toneAmber
class node_catalog,node_categories,node_units,node_inventory,node_warehouses,node_locations toneMint
class node_suppliers,node_orders toneRose
class node_prisma,node_database toneIndigo
```

## Components

### API entry

- [Express app](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/app.ts): `backend/src/app.ts`

### Accounts and workforce

- [Authentication](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/auth/auth.controller.ts): `backend/src/modules/auth/auth.controller.ts`
- [User administration](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/users): `backend/src/modules/users`
- [Departments](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/departments/department.controller.ts): `backend/src/modules/departments/department.controller.ts`
- [Employees](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/employees/employee.controller.ts): `backend/src/modules/employees/employee.controller.ts`
- [Employee salary](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/employees/employee-salary.controller.ts): `backend/src/modules/employees/employee-salary.controller.ts`
- [Salary components](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/salary-components): `backend/src/modules/salary-components`
- [Payroll](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/payrolls/payroll.controller.ts): `backend/src/modules/payrolls/payroll.controller.ts`

### Inventory and catalog

- [Product catalog](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/products): `backend/src/modules/products`
- [Product categories](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/product-categories): `backend/src/modules/product-categories`
- [Units](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/units): `backend/src/modules/units`
- [Stock operations](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/inventory/inventory.controller.ts): `backend/src/modules/inventory/inventory.controller.ts`
- [Warehouses](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/warehouses): `backend/src/modules/warehouses`
- [Warehouse locations](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/warehouse-locations): `backend/src/modules/warehouse-locations`

### Purchasing

- [Suppliers](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/tree/main/backend/src/modules/suppliers): `backend/src/modules/suppliers`
- [Purchase orders](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/modules/purchase-orders/purchase-order.controller.ts): `backend/src/modules/purchase-orders/purchase-order.controller.ts`

### Shared infrastructure

- [Prisma client](https://github.com/mehedi-hasan-raju/garments-factory-erp-software/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`
- **PostgreSQL**

### Other components

- **ERP client**

## Connections

- ERP client → Express app: sends requests (evidence: `backend/src/app.ts`)
- Express app → Authentication: mounts auth routes (evidence: `backend/src/app.ts`)
- Express app → User administration: mounts user routes (evidence: `backend/src/app.ts`)
- Express app → Departments: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Employees: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Employee salary: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Salary components: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Payroll: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Product catalog: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Product categories: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Units: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Stock operations: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Warehouses: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Warehouse locations: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Suppliers: mounts routes (evidence: `backend/src/app.ts`)
- Express app → Purchase orders: mounts routes (evidence: `backend/src/app.ts`)
- Authentication → Prisma client: reads and writes via repository
- Stock operations → Prisma client: uses repository and client
- Purchase orders → Prisma client: repository uses client
- Prisma client → PostgreSQL: connects through adapter (evidence: `backend/src/lib/prisma.ts`)
- Stock operations → PostgreSQL: persists stock operations
