# xuantruongfpt28/quanlicuahang architecture

> Architecture diagram of the GitHub repository xuantruongfpt28/quanlicuahang, 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/xuantruongfpt28/quanlicuahang
- Repository: https://github.com/xuantruongfpt28/quanlicuahang

## Overview

This is a small electric-vehicle shop customer-management application. Staff load and search customer records, create or edit sales, print a sales receipt/contract, and export filtered records; Google Forms can also submit customer data through a webhook. The backend exposes customer CRUD and separate branch CRUD handlers, although the sampled app does not mount the branch routes. The source excerpts establish the customer API and persistence calls; branch mounting, database-provider wiring, and some frontend rendering details were not shown.

Main entry points: [`cua-hang-frontend/src/components/CustomerManagement.tsx`](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/cua-hang-frontend/src/components/CustomerManagement.tsx) (Customer management), [`backend/src/routes/customerRoutes.ts`](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/routes/customerRoutes.ts) (Customer routes), [`backend/src/config/database.ts`](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/config/database.ts) (Prisma client), [`cua-hang-frontend/src/App.tsx`](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/cua-hang-frontend/src/App.tsx) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Shop frontend"]
  node_app_ui["Application shell<br/>[App.tsx]"]
  node_customer_ui["Customer management"]
  node_contract["Contract print<br/>[ContractPrint.tsx]"]
end

subgraph group_api["Backend API"]
  node_http_app["Express application<br/>[app.ts]"]
  node_customer_routes["Customer routes<br/>[customerRoutes.ts]"]
  node_customer_logic["Customer operations"]
  node_form_ingest["Form ingestion"]
  node_branch_routes["Branch routes<br/>[branchRoutes.ts]"]
  node_branch_logic["Branch operations"]
end

subgraph group_persistence["Persistence"]
  node_db_client["Prisma client<br/>[database.ts]"]
  node_db_schema[("Data schema<br/>[schema.prisma]")]
end

node_staff(("Shop staff"))
node_googleform(("Google Form"))

node_staff -->|"uses"| node_app_ui
node_app_ui -->|"renders"| node_customer_ui
node_customer_ui -->|"requests customer API"| node_http_app
node_customer_ui -.->|"prints contract"| node_contract
node_http_app -->|"mounts"| node_customer_routes
node_customer_routes -->|"dispatches"| node_customer_logic
node_googleform -.->|"submits webhook"| node_customer_routes
node_customer_logic -->|"reads/writes"| node_db_client
node_form_ingest -->|"writes"| node_db_client
node_branch_routes -->|"dispatches"| node_branch_logic
node_branch_logic -->|"reads/writes"| node_db_client

click node_app_ui "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/cua-hang-frontend/src/App.tsx"
click node_customer_ui "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/cua-hang-frontend/src/components/CustomerManagement.tsx"
click node_contract "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/cua-hang-frontend/src/components/ContractPrint.tsx"
click node_http_app "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/app.ts"
click node_customer_routes "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/routes/customerRoutes.ts"
click node_customer_logic "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/controllers/customerController.ts"
click node_form_ingest "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/controllers/createCustomerFromGoogleForm.ts"
click node_branch_routes "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/routes/branchRoutes.ts"
click node_branch_logic "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/controllers/branchController.ts"
click node_db_client "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/config/database.ts"
click node_db_schema "https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/prisma/schema.prisma"

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_ui,node_customer_ui,node_contract toneBlue
class node_http_app,node_customer_routes,node_customer_logic,node_form_ingest,node_branch_routes,node_branch_logic toneAmber
class node_db_client,node_db_schema toneMint
class node_staff,node_googleform toneIndigo
```

## Components

### Shop frontend

- [Application shell](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/cua-hang-frontend/src/App.tsx): `cua-hang-frontend/src/App.tsx`
- [Customer management](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/cua-hang-frontend/src/components/CustomerManagement.tsx): `cua-hang-frontend/src/components/CustomerManagement.tsx`
- [Contract print](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/cua-hang-frontend/src/components/ContractPrint.tsx): `cua-hang-frontend/src/components/ContractPrint.tsx`

### Backend API

- [Express application](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Customer routes](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/routes/customerRoutes.ts): `backend/src/routes/customerRoutes.ts`
- [Customer operations](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/controllers/customerController.ts): `backend/src/controllers/customerController.ts`
- [Form ingestion](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/controllers/createCustomerFromGoogleForm.ts): `backend/src/controllers/createCustomerFromGoogleForm.ts`
- [Branch routes](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/routes/branchRoutes.ts): `backend/src/routes/branchRoutes.ts`
- [Branch operations](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/controllers/branchController.ts): `backend/src/controllers/branchController.ts`

### Persistence

- [Prisma client](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/src/config/database.ts): `backend/src/config/database.ts`
- [Data schema](https://github.com/xuantruongfpt28/quanlicuahang/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Other components

- **Shop staff**
- **Google Form**

## Connections

- Shop staff → Application shell: uses (evidence: `cua-hang-frontend/src/App.tsx`)
- Application shell → Customer management: renders (evidence: `cua-hang-frontend/src/App.tsx`)
- Customer management → Express application: requests customer API (evidence: `cua-hang-frontend/src/components/CustomerManagement.tsx`)
- Customer management → Contract print: prints contract (evidence: `cua-hang-frontend/src/components/CustomerManagement.tsx`)
- Express application → Customer routes: mounts (evidence: `backend/src/app.ts`)
- Customer routes → Customer operations: dispatches (evidence: `backend/src/routes/customerRoutes.ts`)
- Google Form → Customer routes: submits webhook
- Customer operations → Prisma client: reads/writes (evidence: `backend/src/controllers/customerController.ts`)
- Form ingestion → Prisma client: writes (evidence: `backend/src/controllers/createCustomerFromGoogleForm.ts`)
- Branch routes → Branch operations: dispatches (evidence: `backend/src/routes/branchRoutes.ts`)
- Branch operations → Prisma client: reads/writes (evidence: `backend/src/controllers/branchController.ts`)
