# bilalahmad7723/factoryproject architecture

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

- Interactive diagram: https://gitdiagram.com/bilalahmad7723/factoryproject
- Repository: https://github.com/bilalahmad7723/factoryproject

## Overview

Factory-BK is an Express/Mongoose backend for customer, article, admin, notification, and file-upload operations. The main request path runs from HTTP routes through controllers and services to data models, with controllers formatting responses. File uploads are handled directly by an upload route and written to local storage. The README provides no feature detail, so the domain map relies on the source index and sampled files; unsampled service behavior and notification persistence links are not inferred.

Main entry points: [`routes/index.js`](https://github.com/bilalahmad7723/factoryproject/blob/main/routes/index.js) (Route Mounts), [`app.js`](https://github.com/bilalahmad7723/factoryproject/blob/main/app.js) (Express App), [`controllers/customer.controller.js`](https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/customer.controller.js) (Customer Controller), [`controllers/article.controller.js`](https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/article.controller.js) (Article Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["HTTP Routing"]
  node_app["Express App<br/>[app.js]"]
  node_route_index["Route Mounts<br/>[index.js]"]
  node_customer_routes["Customer Routes<br/>[customer.routes.js]"]
  node_article_routes["Article Routes<br/>[article.routes.js]"]
  node_admin_routes["Admin Routes<br/>[admin.routes.js]"]
  node_notification_routes["Notification Routes"]
end

subgraph group_domain["Domain Operations"]
  node_customer_controller["Customer Controller"]
  node_article_controller["Article Controller"]
  node_admin_controller["Admin Controller"]
  node_notification_controller["Notification Controller"]
  node_customer_service["Customer Service"]
  node_article_service["Article Service<br/>[article.service.js]"]
  node_admin_service["Admin Service<br/>[admin.service.js]"]
  node_notification_service["Notification Service"]
  node_response_helper["Response Formatter<br/>[response.helper.js]"]
  node_customer_helper["Customer Helper<br/>[customer.helper.js]"]
end

subgraph group_data["Data Access"]
  node_article_model["Article Model<br/>[articles.model.js]"]
  node_customer_model["Customer Model<br/>[customers.model.js]"]
  node_database[("MongoDB<br/>[database.js]")]
end

subgraph group_files["File Upload"]
  node_upload_routes["Upload Route"]
  node_upload_storage[("Local File Storage")]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_route_index
node_app -->|"connects to"| node_database
node_route_index -->|"mounts"| node_customer_routes
node_route_index -->|"mounts"| node_article_routes
node_route_index -->|"mounts"| node_admin_routes
node_route_index -->|"mounts"| node_notification_routes
node_route_index -->|"mounts"| node_upload_routes
node_customer_routes -->|"dispatches to"| node_customer_controller
node_article_routes -->|"dispatches to"| node_article_controller
node_admin_routes -->|"dispatches to"| node_admin_controller
node_notification_routes -->|"dispatches to"| node_notification_controller
node_customer_controller -->|"calls"| node_customer_service
node_article_controller -->|"calls"| node_article_service
node_notification_controller -->|"calls"| node_notification_service
node_admin_controller -->|"delegates to"| node_admin_service
node_customer_controller -->|"formats with"| node_response_helper
node_article_controller -->|"formats with"| node_response_helper
node_notification_controller -->|"formats with"| node_response_helper
node_customer_service -->|"uses"| node_customer_model
node_article_service -->|"queries"| node_article_model
node_admin_service -->|"uses"| node_customer_helper
node_upload_routes -->|"writes files"| node_upload_storage

click node_app "https://github.com/bilalahmad7723/factoryproject/blob/main/app.js"
click node_route_index "https://github.com/bilalahmad7723/factoryproject/blob/main/routes/index.js"
click node_customer_routes "https://github.com/bilalahmad7723/factoryproject/blob/main/routes/customer.routes.js"
click node_article_routes "https://github.com/bilalahmad7723/factoryproject/blob/main/routes/article.routes.js"
click node_admin_routes "https://github.com/bilalahmad7723/factoryproject/blob/main/routes/admin.routes.js"
click node_notification_routes "https://github.com/bilalahmad7723/factoryproject/blob/main/routes/notification.routes.js"
click node_upload_routes "https://github.com/bilalahmad7723/factoryproject/blob/main/routes/fileUpload.routes.js"
click node_customer_controller "https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/customer.controller.js"
click node_article_controller "https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/article.controller.js"
click node_admin_controller "https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/admin.controller.js"
click node_notification_controller "https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/notification.controller.js"
click node_customer_service "https://github.com/bilalahmad7723/factoryproject/blob/main/services/customer.service.js"
click node_article_service "https://github.com/bilalahmad7723/factoryproject/blob/main/services/article.service.js"
click node_admin_service "https://github.com/bilalahmad7723/factoryproject/blob/main/services/admin.service.js"
click node_notification_service "https://github.com/bilalahmad7723/factoryproject/blob/main/services/notification.service.js"
click node_response_helper "https://github.com/bilalahmad7723/factoryproject/blob/main/helpers/response.helper.js"
click node_customer_helper "https://github.com/bilalahmad7723/factoryproject/blob/main/helpers/customer.helper.js"
click node_article_model "https://github.com/bilalahmad7723/factoryproject/blob/main/models/articles.model.js"
click node_customer_model "https://github.com/bilalahmad7723/factoryproject/blob/main/models/customers.model.js"
click node_database "https://github.com/bilalahmad7723/factoryproject/blob/main/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_route_index,node_customer_routes,node_article_routes,node_admin_routes,node_notification_routes,node_client toneBlue
class node_customer_controller,node_article_controller,node_admin_controller,node_notification_controller,node_customer_service,node_article_service,node_admin_service,node_notification_service,node_response_helper,node_customer_helper toneAmber
class node_article_model,node_customer_model,node_database toneMint
class node_upload_routes,node_upload_storage toneRose
```

## Components

### HTTP Routing

- [Express App](https://github.com/bilalahmad7723/factoryproject/blob/main/app.js): `app.js`
- [Route Mounts](https://github.com/bilalahmad7723/factoryproject/blob/main/routes/index.js): `routes/index.js`
- [Customer Routes](https://github.com/bilalahmad7723/factoryproject/blob/main/routes/customer.routes.js): `routes/customer.routes.js`
- [Article Routes](https://github.com/bilalahmad7723/factoryproject/blob/main/routes/article.routes.js): `routes/article.routes.js`
- [Admin Routes](https://github.com/bilalahmad7723/factoryproject/blob/main/routes/admin.routes.js): `routes/admin.routes.js`
- [Notification Routes](https://github.com/bilalahmad7723/factoryproject/blob/main/routes/notification.routes.js): `routes/notification.routes.js`

### Domain Operations

- [Customer Controller](https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/customer.controller.js): `controllers/customer.controller.js`
- [Article Controller](https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/article.controller.js): `controllers/article.controller.js`
- [Admin Controller](https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/admin.controller.js): `controllers/admin.controller.js`
- [Notification Controller](https://github.com/bilalahmad7723/factoryproject/blob/main/controllers/notification.controller.js): `controllers/notification.controller.js`
- [Customer Service](https://github.com/bilalahmad7723/factoryproject/blob/main/services/customer.service.js): `services/customer.service.js`
- [Article Service](https://github.com/bilalahmad7723/factoryproject/blob/main/services/article.service.js): `services/article.service.js`
- [Admin Service](https://github.com/bilalahmad7723/factoryproject/blob/main/services/admin.service.js): `services/admin.service.js`
- [Notification Service](https://github.com/bilalahmad7723/factoryproject/blob/main/services/notification.service.js): `services/notification.service.js`
- [Response Formatter](https://github.com/bilalahmad7723/factoryproject/blob/main/helpers/response.helper.js): `helpers/response.helper.js`
- [Customer Helper](https://github.com/bilalahmad7723/factoryproject/blob/main/helpers/customer.helper.js): `helpers/customer.helper.js`

### Data Access

- [Article Model](https://github.com/bilalahmad7723/factoryproject/blob/main/models/articles.model.js): `models/articles.model.js`
- [Customer Model](https://github.com/bilalahmad7723/factoryproject/blob/main/models/customers.model.js): `models/customers.model.js`
- [MongoDB](https://github.com/bilalahmad7723/factoryproject/blob/main/config/database.js): `config/database.js`

### File Upload

- [Upload Route](https://github.com/bilalahmad7723/factoryproject/blob/main/routes/fileUpload.routes.js): `routes/fileUpload.routes.js`
- **Local File Storage**

### Other components

- **API Client**

## Connections

- API Client → Express App: sends requests
- Express App → Route Mounts: mounts routes (evidence: `app.js`)
- Express App → MongoDB: connects to (evidence: `app.js`)
- Route Mounts → Customer Routes: mounts (evidence: `routes/index.js`)
- Route Mounts → Article Routes: mounts (evidence: `routes/index.js`)
- Route Mounts → Admin Routes: mounts (evidence: `routes/index.js`)
- Route Mounts → Notification Routes: mounts (evidence: `routes/index.js`)
- Route Mounts → Upload Route: mounts (evidence: `routes/index.js`)
- Customer Routes → Customer Controller: dispatches to (evidence: `routes/customer.routes.js`)
- Article Routes → Article Controller: dispatches to (evidence: `routes/article.routes.js`)
- Admin Routes → Admin Controller: dispatches to (evidence: `routes/admin.routes.js`)
- Notification Routes → Notification Controller: dispatches to (evidence: `routes/notification.routes.js`)
- Customer Controller → Customer Service: calls (evidence: `controllers/customer.controller.js`)
- Article Controller → Article Service: calls (evidence: `controllers/article.controller.js`)
- Notification Controller → Notification Service: calls (evidence: `controllers/notification.controller.js`)
- Admin Controller → Admin Service: delegates to (evidence: `controllers/admin.controller.js`)
- Customer Controller → Response Formatter: formats with (evidence: `controllers/customer.controller.js`)
- Article Controller → Response Formatter: formats with (evidence: `controllers/article.controller.js`)
- Notification Controller → Response Formatter: formats with (evidence: `controllers/notification.controller.js`)
- Customer Service → Customer Model: uses (evidence: `services/customer.service.js`)
- Article Service → Article Model: queries (evidence: `services/article.service.js`)
- Admin Service → Customer Helper: uses (evidence: `services/admin.service.js`)
- Upload Route → Local File Storage: writes files (evidence: `routes/fileUpload.routes.js`)
