# yashu112008/-mall- architecture

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

- Interactive diagram: https://gitdiagram.com/yashu112008/-mall-
- Repository: https://github.com/yashu112008/-mall-

## Overview

Mall Manager is a mall-operations web app for managing stores, tenants, rent, parking, users, and dashboard summaries. A staff member or manager uses the browser interface, which calls the Express API; the API authenticates requests and serves the relevant management operation backed by SQLite. Account registration, login, and password recovery form a separate identity workflow. The graph includes all documented core route modules; edges are limited to relationships shown in excerpts, the source index, or README. Some frontend-to-server wiring is documented only at a high level.

Main entry points: [`backend/server.js`](https://github.com/yashu112008/-mall-/blob/main/backend/server.js) (Express server), [`backend/src/routes/crud.js`](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/crud.js) (Shared CRUD router), [`backend/src/routes/auth.js`](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/auth.js) (Authentication routes), [`backend/src/db.js`](https://github.com/yashu112008/-mall-/blob/main/backend/src/db.js) (Mall database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser application"]
  node_web_app["Operations UI<br/>[app.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_ui_helpers["UI helpers<br/>[ui.js]"]
end

subgraph group_identity["Identity and access"]
  node_login_ui["Login<br/>[login.js]"]
  node_registration_ui["Registration<br/>[register.js]"]
  node_forgot_ui["Forgot password<br/>[forgot.js]"]
  node_reset_ui["Password reset<br/>[reset.js]"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_auth_middleware["Session authentication<br/>[auth.js]"]
  node_user_routes["User administration<br/>[users.js]"]
  node_mailer["Reset email<br/>[mailer.js]"]
end

subgraph group_operations["Mall operations"]
  node_stores["Store management<br/>[stores.js]"]
  node_tenants["Tenant management<br/>[tenants.js]"]
  node_rent["Rent management<br/>[rent.js]"]
  node_parking["Parking management<br/>[parking.js]"]
  node_dashboard["Dashboard<br/>[dashboard.js]"]
  node_crud["Shared CRUD router<br/>[crud.js]"]
end

subgraph group_platform["API and persistence"]
  node_http_server["Express server<br/>[server.js]"]
  node_validation["Input validation<br/>[validate.js]"]
  node_audit["Audit logging<br/>[audit.js]"]
  node_database[("Mall database<br/>[db.js]")]
end

node_operator(("Mall user"))

node_operator -->|"uses"| node_web_app
node_web_app -->|"server calls"| node_api_client
node_api_client -->|"sends requests"| node_http_server
node_http_server -->|"mounts routes"| node_auth_routes
node_http_server -->|"mounts routes"| node_user_routes
node_http_server -->|"mounts routes"| node_stores
node_http_server -->|"mounts routes"| node_tenants
node_http_server -->|"mounts routes"| node_rent
node_http_server -->|"mounts routes"| node_parking
node_http_server -->|"mounts routes"| node_dashboard
node_http_server -->|"authenticates requests"| node_auth_middleware
node_auth_routes -->|"validates input"| node_validation
node_auth_routes -->|"guards sessions"| node_auth_middleware
node_auth_routes -->|"reads and writes"| node_database
node_auth_routes -->|"records events"| node_audit
node_auth_routes -->|"sends reset email"| node_mailer
node_auth_middleware -->|"checks session"| node_database
node_user_routes -->|"checks roles"| node_auth_middleware
node_user_routes -->|"validates input"| node_validation
node_user_routes -->|"reads and writes"| node_database
node_user_routes -->|"records changes"| node_audit
node_stores -->|"creates router"| node_crud
node_tenants -->|"creates router"| node_crud
node_rent -->|"creates router"| node_crud
node_parking -->|"creates router"| node_crud
node_crud -->|"reads and writes"| node_database
node_crud -->|"validates input"| node_validation
node_crud -->|"checks roles"| node_auth_middleware
node_crud -->|"records changes"| node_audit
node_dashboard -->|"queries summaries"| node_database
node_audit -->|"writes events"| node_database

click node_web_app "https://github.com/yashu112008/-mall-/blob/main/frontend/js/app.js"
click node_api_client "https://github.com/yashu112008/-mall-/blob/main/frontend/js/api.js"
click node_ui_helpers "https://github.com/yashu112008/-mall-/blob/main/frontend/js/ui.js"
click node_login_ui "https://github.com/yashu112008/-mall-/blob/main/frontend/js/login.js"
click node_registration_ui "https://github.com/yashu112008/-mall-/blob/main/frontend/js/register.js"
click node_forgot_ui "https://github.com/yashu112008/-mall-/blob/main/frontend/js/forgot.js"
click node_reset_ui "https://github.com/yashu112008/-mall-/blob/main/frontend/js/reset.js"
click node_http_server "https://github.com/yashu112008/-mall-/blob/main/backend/server.js"
click node_auth_routes "https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/auth.js"
click node_auth_middleware "https://github.com/yashu112008/-mall-/blob/main/backend/src/middleware/auth.js"
click node_user_routes "https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/users.js"
click node_validation "https://github.com/yashu112008/-mall-/blob/main/backend/src/middleware/validate.js"
click node_stores "https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/stores.js"
click node_tenants "https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/tenants.js"
click node_rent "https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/rent.js"
click node_parking "https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/parking.js"
click node_dashboard "https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/dashboard.js"
click node_crud "https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/crud.js"
click node_audit "https://github.com/yashu112008/-mall-/blob/main/backend/src/audit.js"
click node_mailer "https://github.com/yashu112008/-mall-/blob/main/backend/src/mailer.js"
click node_database "https://github.com/yashu112008/-mall-/blob/main/backend/src/db.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_web_app,node_api_client,node_ui_helpers,node_operator toneBlue
class node_login_ui,node_registration_ui,node_forgot_ui,node_reset_ui,node_auth_routes,node_auth_middleware,node_user_routes,node_mailer toneAmber
class node_stores,node_tenants,node_rent,node_parking,node_dashboard,node_crud toneMint
class node_http_server,node_validation,node_audit,node_database toneRose
```

## Components

### Browser application

- [Operations UI](https://github.com/yashu112008/-mall-/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [API client](https://github.com/yashu112008/-mall-/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [UI helpers](https://github.com/yashu112008/-mall-/blob/main/frontend/js/ui.js): `frontend/js/ui.js`

### Identity and access

- [Login](https://github.com/yashu112008/-mall-/blob/main/frontend/js/login.js): `frontend/js/login.js`
- [Registration](https://github.com/yashu112008/-mall-/blob/main/frontend/js/register.js): `frontend/js/register.js`
- [Forgot password](https://github.com/yashu112008/-mall-/blob/main/frontend/js/forgot.js): `frontend/js/forgot.js`
- [Password reset](https://github.com/yashu112008/-mall-/blob/main/frontend/js/reset.js): `frontend/js/reset.js`
- [Authentication routes](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Session authentication](https://github.com/yashu112008/-mall-/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [User administration](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/users.js): `backend/src/routes/users.js`
- [Reset email](https://github.com/yashu112008/-mall-/blob/main/backend/src/mailer.js): `backend/src/mailer.js`

### Mall operations

- [Store management](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/stores.js): `backend/src/routes/stores.js`
- [Tenant management](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/tenants.js): `backend/src/routes/tenants.js`
- [Rent management](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/rent.js): `backend/src/routes/rent.js`
- [Parking management](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/parking.js): `backend/src/routes/parking.js`
- [Dashboard](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/dashboard.js): `backend/src/routes/dashboard.js`
- [Shared CRUD router](https://github.com/yashu112008/-mall-/blob/main/backend/src/routes/crud.js): `backend/src/routes/crud.js`

### API and persistence

- [Express server](https://github.com/yashu112008/-mall-/blob/main/backend/server.js): `backend/server.js`
- [Input validation](https://github.com/yashu112008/-mall-/blob/main/backend/src/middleware/validate.js): `backend/src/middleware/validate.js`
- [Audit logging](https://github.com/yashu112008/-mall-/blob/main/backend/src/audit.js): `backend/src/audit.js`
- [Mall database](https://github.com/yashu112008/-mall-/blob/main/backend/src/db.js): `backend/src/db.js`

### Other components

- **Mall user**

## Connections

- Mall user → Operations UI: uses (evidence: `README.md`)
- Operations UI → API client: server calls (evidence: `README.md`)
- API client → Express server: sends requests (evidence: `README.md`)
- Express server → Authentication routes: mounts routes (evidence: `backend/server.js`)
- Express server → User administration: mounts routes (evidence: `backend/server.js`)
- Express server → Store management: mounts routes (evidence: `backend/server.js`)
- Express server → Tenant management: mounts routes (evidence: `backend/server.js`)
- Express server → Rent management: mounts routes (evidence: `backend/server.js`)
- Express server → Parking management: mounts routes (evidence: `backend/server.js`)
- Express server → Dashboard: mounts routes (evidence: `backend/server.js`)
- Express server → Session authentication: authenticates requests (evidence: `backend/server.js`)
- Authentication routes → Input validation: validates input (evidence: `backend/src/routes/auth.js`)
- Authentication routes → Session authentication: guards sessions (evidence: `backend/src/routes/auth.js`)
- Authentication routes → Mall database: reads and writes (evidence: `backend/src/routes/auth.js`)
- Authentication routes → Audit logging: records events (evidence: `backend/src/routes/auth.js`)
- Authentication routes → Reset email: sends reset email (evidence: `backend/src/routes/auth.js`)
- Session authentication → Mall database: checks session (evidence: `backend/src/middleware/auth.js`)
- User administration → Session authentication: checks roles (evidence: `backend/src/routes/users.js`)
- User administration → Input validation: validates input (evidence: `backend/src/routes/users.js`)
- User administration → Mall database: reads and writes (evidence: `backend/src/routes/users.js`)
- User administration → Audit logging: records changes (evidence: `backend/src/routes/users.js`)
- Store management → Shared CRUD router: creates router (evidence: `backend/src/routes/stores.js`)
- Tenant management → Shared CRUD router: creates router (evidence: `backend/src/routes/tenants.js`)
- Rent management → Shared CRUD router: creates router (evidence: `backend/src/routes/rent.js`)
- Parking management → Shared CRUD router: creates router (evidence: `backend/src/routes/parking.js`)
- Shared CRUD router → Mall database: reads and writes (evidence: `backend/src/routes/crud.js`)
- Shared CRUD router → Input validation: validates input (evidence: `backend/src/routes/crud.js`)
- Shared CRUD router → Session authentication: checks roles (evidence: `backend/src/routes/crud.js`)
- Shared CRUD router → Audit logging: records changes (evidence: `backend/src/routes/crud.js`)
- Dashboard → Mall database: queries summaries (evidence: `backend/src/routes/dashboard.js`)
- Audit logging → Mall database: writes events (evidence: `backend/src/audit.js`)
