# ghassenbz/clienta architecture

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

- Interactive diagram: https://gitdiagram.com/ghassenbz/clienta
- Repository: https://github.com/ghassenbz/clienta

## Overview

Clienta is a three-tier customer-management app: browser users view, search, create, update, and delete customers through a same-origin Express API backed by MySQL. The backend routes requests to customer operations, which validate data and query the database; startup also initializes the customer table from the schema. The repository includes a separate Terraform-based AWS deployment configuration. Deployment relationships below are limited to capabilities documented in the README; the Terraform source was not sampled.

Main entry points: [`infra/main.tf`](https://github.com/ghassenbz/clienta/blob/main/infra/main.tf) (Terraform configuration), [`app/backend/app.js`](https://github.com/ghassenbz/clienta/blob/main/app/backend/app.js) (Express server), [`app/backend/routes/customer.js`](https://github.com/ghassenbz/clienta/blob/main/app/backend/routes/customer.js) (Customer routes), [`app/backend/db.js`](https://github.com/ghassenbz/clienta/blob/main/app/backend/db.js) (MySQL pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser frontend"]
  node_ui["Customer interface<br/>[index.html]"]
  node_interactions["Customer interactions<br/>[script.js]"]
end

subgraph group_backend["Application backend"]
  node_server["Express server<br/>[app.js]"]
  node_routes["Customer routes<br/>[customer.js]"]
  node_controller["Customer operations"]
  node_pool["MySQL pool<br/>[db.js]"]
  node_schema["Customer schema<br/>[db.sql]"]
end

subgraph group_deployment["AWS deployment"]
  node_terraform["Terraform configuration<br/>[main.tf]"]
  node_compute["Compute module<br/>[main.tf]"]
  node_network["Network module<br/>[main.tf]"]
  node_security["Security module<br/>[main.tf]"]
end

node_user(("Browser user"))
node_mysql[("MySQL database")]
node_s3[("Private S3 bucket")]
node_instance["App instance"]
node_aws["AWS environment"]

node_user -->|"uses"| node_ui
node_ui -.->|"hosts"| node_interactions
node_interactions -->|"requests API"| node_routes
node_server -->|"mounts API"| node_routes
node_routes -->|"dispatches"| node_controller
node_controller -->|"queries"| node_pool
node_server -->|"initializes database"| node_pool
node_server -->|"loads schema"| node_schema
node_pool -.->|"connects"| node_mysql
node_terraform -->|"uploads archive"| node_s3
node_instance -->|"reads archive"| node_s3
node_terraform -.->|"uses module"| node_compute
node_terraform -.->|"uses module"| node_network
node_terraform -.->|"uses module"| node_security
node_terraform -.->|"provisions resources"| node_aws

click node_ui "https://github.com/ghassenbz/clienta/blob/main/app/frontend/index.html"
click node_interactions "https://github.com/ghassenbz/clienta/blob/main/app/frontend/script.js"
click node_server "https://github.com/ghassenbz/clienta/blob/main/app/backend/app.js"
click node_routes "https://github.com/ghassenbz/clienta/blob/main/app/backend/routes/customer.js"
click node_controller "https://github.com/ghassenbz/clienta/blob/main/app/backend/controllers/customerController.js"
click node_pool "https://github.com/ghassenbz/clienta/blob/main/app/backend/db.js"
click node_schema "https://github.com/ghassenbz/clienta/blob/main/app/database/db.sql"
click node_terraform "https://github.com/ghassenbz/clienta/blob/main/infra/main.tf"
click node_compute "https://github.com/ghassenbz/clienta/blob/main/infra/modules/compute/main.tf"
click node_network "https://github.com/ghassenbz/clienta/blob/main/infra/modules/network/main.tf"
click node_security "https://github.com/ghassenbz/clienta/blob/main/infra/modules/security/main.tf"

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_ui,node_interactions,node_user toneBlue
class node_server,node_routes,node_controller,node_pool,node_schema,node_mysql,node_s3 toneAmber
class node_terraform,node_compute,node_network,node_security toneMint
class node_instance,node_aws toneIndigo
```

## Components

### Browser frontend

- [Customer interface](https://github.com/ghassenbz/clienta/blob/main/app/frontend/index.html): `app/frontend/index.html`
- [Customer interactions](https://github.com/ghassenbz/clienta/blob/main/app/frontend/script.js): `app/frontend/script.js`

### Application backend

- [Express server](https://github.com/ghassenbz/clienta/blob/main/app/backend/app.js): `app/backend/app.js`
- [Customer routes](https://github.com/ghassenbz/clienta/blob/main/app/backend/routes/customer.js): `app/backend/routes/customer.js`
- [Customer operations](https://github.com/ghassenbz/clienta/blob/main/app/backend/controllers/customerController.js): `app/backend/controllers/customerController.js`
- [MySQL pool](https://github.com/ghassenbz/clienta/blob/main/app/backend/db.js): `app/backend/db.js`
- [Customer schema](https://github.com/ghassenbz/clienta/blob/main/app/database/db.sql): `app/database/db.sql`

### AWS deployment

- [Terraform configuration](https://github.com/ghassenbz/clienta/blob/main/infra/main.tf): `infra/main.tf`
- [Compute module](https://github.com/ghassenbz/clienta/blob/main/infra/modules/compute/main.tf): `infra/modules/compute/main.tf`
- [Network module](https://github.com/ghassenbz/clienta/blob/main/infra/modules/network/main.tf): `infra/modules/network/main.tf`
- [Security module](https://github.com/ghassenbz/clienta/blob/main/infra/modules/security/main.tf): `infra/modules/security/main.tf`

### Other components

- **Browser user**
- **MySQL database**
- **Private S3 bucket**
- **App instance**
- **AWS environment**

## Connections

- Browser user → Customer interface: uses (evidence: `README.md`)
- Customer interface → Customer interactions: hosts
- Customer interactions → Customer routes: requests API (evidence: `app/frontend/script.js`)
- Express server → Customer routes: mounts API (evidence: `app/backend/app.js`)
- Customer routes → Customer operations: dispatches (evidence: `app/backend/routes/customer.js`)
- Customer operations → MySQL pool: queries (evidence: `app/backend/controllers/customerController.js`)
- Express server → MySQL pool: initializes database (evidence: `app/backend/app.js`)
- Express server → Customer schema: loads schema (evidence: `app/backend/app.js`)
- MySQL pool → MySQL database: connects
- Terraform configuration → Private S3 bucket: uploads archive (evidence: `README.md`)
- App instance → Private S3 bucket: reads archive (evidence: `README.md`)
- Terraform configuration → Compute module: uses module
- Terraform configuration → Network module: uses module
- Terraform configuration → Security module: uses module
- Terraform configuration → AWS environment: provisions resources
