# khoaanh0405/crm_shoesstore architecture

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

- Interactive diagram: https://gitdiagram.com/khoaanh0405/crm_shoesstore
- Repository: https://github.com/khoaanh0405/crm_shoesstore

## Overview

This repository’s evidenced product is a backend CRM API for customer/account management and customer surveys. Customers register or log in, access and update their profiles, and can submit assigned surveys; administrators manage accounts and customers, create and assign surveys, and inspect results. The graph emphasizes those domain stages and the API-to-service-to-data layers. Survey routes and account/customer flows are sampled; other capabilities are represented from the file tree, so their internal wiring is not inferred.

Main entry points: [`backend/src/routes/survey.routes.js`](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/routes/survey.routes.js) (Survey routes), [`backend/src/app.js`](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/app.js) (Express app), [`backend/src/routes/customer.routes.js`](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/routes/customer.routes.js) (Customer routes), [`backend/src/services/account.service.js`](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/services/account.service.js) (Account service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_app["Express app<br/>[app.js]"]
  node_account_routes["Account routes<br/>[account.routes.js]"]
  node_customer_routes["Customer routes<br/>[customer.routes.js]"]
  node_survey_routes["Survey routes<br/>[survey.routes.js]"]
  node_token["JWT signing<br/>[jwt.util.js]"]
end

subgraph group_identity["Accounts and customers"]
  node_account_controller["Account controller"]
  node_account_service["Account service<br/>[account.service.js]"]
  node_account_repository["Account repository"]
  node_customer_controller["Customer controller"]
  node_customer_service["Customer service"]
  node_customer_repository["Customer repository"]
  node_preference["Customer preferences"]
  node_feedback["Customer feedback"]
end

subgraph group_surveys["Survey lifecycle"]
  node_survey_controller["Survey controller"]
  node_survey_service["Survey service<br/>[survey.service.js]"]
  node_survey_repository["Survey repository"]
  node_survey_responses["Survey responses"]
  node_survey_answers["Answers and stats"]
  node_survey_targets["Survey assignments"]
end

subgraph group_data["Persistence"]
  node_database_config["Prisma connection<br/>[database.js]"]
  node_postgres[("PostgreSQL")]
end

node_admin(("Administrator"))
node_customer(("Customer"))

node_customer -->|"calls API"| node_app
node_admin -->|"calls API"| node_app
node_app -->|"mounts API"| node_account_routes
node_app -->|"mounts API"| node_customer_routes
node_app -->|"mounts API"| node_survey_routes
node_account_routes -->|"dispatches"| node_account_controller
node_customer_routes -->|"dispatches"| node_customer_controller
node_customer_routes -->|"dispatches"| node_preference
node_customer_routes -->|"dispatches"| node_feedback
node_survey_routes -->|"dispatches"| node_survey_controller
node_survey_routes -->|"dispatches"| node_survey_responses
node_survey_routes -->|"dispatches"| node_survey_answers
node_survey_routes -->|"dispatches"| node_survey_targets
node_account_controller -->|"calls"| node_account_service
node_account_controller -->|"signs token"| node_token
node_account_service -->|"reads and writes"| node_account_repository
node_account_service -->|"creates account"| node_database_config
node_account_service -->|"writes via Prisma"| node_postgres
node_customer_controller -->|"calls"| node_customer_service
node_customer_service -->|"reads and writes"| node_customer_repository
node_database_config -->|"connects"| node_postgres
node_survey_controller -->|"calls"| node_survey_service
node_survey_service -->|"reads and writes"| node_survey_repository

click node_app "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/app.js"
click node_account_routes "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/routes/account.routes.js"
click node_customer_routes "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/routes/customer.routes.js"
click node_survey_routes "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/routes/survey.routes.js"
click node_account_controller "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/account.controller.js"
click node_account_service "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/services/account.service.js"
click node_account_repository "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/repositories/account.repository.js"
click node_customer_controller "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/customer.controller.js"
click node_customer_service "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/services/customer.service.js"
click node_customer_repository "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/repositories/customer.repository.js"
click node_preference "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/customerPreference.controller.js"
click node_feedback "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/feedback.controller.js"
click node_survey_controller "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/survey.controller.js"
click node_survey_service "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/services/survey.service.js"
click node_survey_repository "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/repositories/survey.repository.js"
click node_survey_responses "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/surveyResponse.controller.js"
click node_survey_answers "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/surveyAnswer.controller.js"
click node_survey_targets "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/surveyTarget.controller.js"
click node_database_config "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/config/database.js"
click node_token "https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/utils/jwt.util.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_account_routes,node_customer_routes,node_survey_routes,node_token toneBlue
class node_account_controller,node_account_service,node_account_repository,node_customer_controller,node_customer_service,node_customer_repository,node_preference,node_feedback toneAmber
class node_survey_controller,node_survey_service,node_survey_repository,node_survey_responses,node_survey_answers,node_survey_targets toneMint
class node_database_config,node_postgres toneRose
class node_admin,node_customer toneIndigo
```

## Components

### API entry

- [Express app](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/app.js): `backend/src/app.js`
- [Account routes](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/routes/account.routes.js): `backend/src/routes/account.routes.js`
- [Customer routes](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/routes/customer.routes.js): `backend/src/routes/customer.routes.js`
- [Survey routes](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/routes/survey.routes.js): `backend/src/routes/survey.routes.js`
- [JWT signing](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/utils/jwt.util.js): `backend/src/utils/jwt.util.js`

### Accounts and customers

- [Account controller](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/account.controller.js): `backend/src/controllers/account.controller.js`
- [Account service](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/services/account.service.js): `backend/src/services/account.service.js`
- [Account repository](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/repositories/account.repository.js): `backend/src/repositories/account.repository.js`
- [Customer controller](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/customer.controller.js): `backend/src/controllers/customer.controller.js`
- [Customer service](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/services/customer.service.js): `backend/src/services/customer.service.js`
- [Customer repository](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/repositories/customer.repository.js): `backend/src/repositories/customer.repository.js`
- [Customer preferences](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/customerPreference.controller.js): `backend/src/controllers/customerPreference.controller.js`
- [Customer feedback](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/feedback.controller.js): `backend/src/controllers/feedback.controller.js`

### Survey lifecycle

- [Survey controller](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/survey.controller.js): `backend/src/controllers/survey.controller.js`
- [Survey service](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/services/survey.service.js): `backend/src/services/survey.service.js`
- [Survey repository](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/repositories/survey.repository.js): `backend/src/repositories/survey.repository.js`
- [Survey responses](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/surveyResponse.controller.js): `backend/src/controllers/surveyResponse.controller.js`
- [Answers and stats](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/surveyAnswer.controller.js): `backend/src/controllers/surveyAnswer.controller.js`
- [Survey assignments](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/controllers/surveyTarget.controller.js): `backend/src/controllers/surveyTarget.controller.js`

### Persistence

- [Prisma connection](https://github.com/khoaanh0405/crm_shoesstore/blob/main/backend/src/config/database.js): `backend/src/config/database.js`
- **PostgreSQL**

### Other components

- **Administrator**
- **Customer**

## Connections

- Customer → Express app: calls API
- Administrator → Express app: calls API
- Express app → Account routes: mounts API
- Express app → Customer routes: mounts API
- Express app → Survey routes: mounts API
- Account routes → Account controller: dispatches
- Customer routes → Customer controller: dispatches
- Customer routes → Customer preferences: dispatches
- Customer routes → Customer feedback: dispatches
- Survey routes → Survey controller: dispatches
- Survey routes → Survey responses: dispatches
- Survey routes → Answers and stats: dispatches
- Survey routes → Survey assignments: dispatches
- Account controller → Account service: calls
- Account controller → JWT signing: signs token
- Account service → Account repository: reads and writes
- Account service → Prisma connection: creates account
- Account service → PostgreSQL: writes via Prisma
- Customer controller → Customer service: calls
- Customer service → Customer repository: reads and writes
- Prisma connection → PostgreSQL: connects
- Survey controller → Survey service: calls
- Survey service → Survey repository: reads and writes
