# rahuljko1/bank-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/rahuljko1/bank-management-system
- Repository: https://github.com/rahuljko1/bank-management-system

## Overview

Smart Bank is a demo-banking web application: users browse public banking pages, sign in or register, then view accounts and transactions, manage their profile, and submit transfers. The browser’s shared API client sends credentialed requests to an Express API; the API uses session authentication and MySQL-backed data. The page tree also includes public information pages and a loan calculator. Backend route details and several frontend-to-endpoint calls were not sampled, so the graph keeps those flows at the API boundary rather than guessing their exact mappings.

Main entry points: [`server/src/app.js`](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/app.js) (Banking API), [`server/src/db.js`](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/db.js) (Database pool), [`server/src/routes/auth.js`](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/routes/auth.js) (Authentication routes), [`server/src/routes/banking.js`](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/routes/banking.js) (Banking routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser experience"]
  node_public_pages["Public banking pages"]
  node_customer_pages["Customer pages"]
  node_page_app["Page workflows<br/>[page-app.js]"]
  node_login_ui["Login forms<br/>[login.js]"]
  node_shared_layout["Shared layout<br/>[shared-layout.js]"]
  node_form_ui["Form validation<br/>[ui.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_identity["Identity and sessions"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_session_guard["Session guard<br/>[session-user.js]"]
end

subgraph group_banking["Banking operations"]
  node_banking_routes["Banking routes<br/>[banking.js]"]
  node_validation["Input validation<br/>[validation.js]"]
end

subgraph group_platform["API and persistence"]
  node_api_server["Banking API<br/>[app.js]"]
  node_db_pool["Database pool<br/>[db.js]"]
  node_mysql[("MySQL data store<br/>[schema.sql]")]
  node_configuration["Runtime configuration<br/>[config.js]"]
  node_http_server["HTTP listener<br/>[server.js]"]
end

node_visitor(("Bank customer"))

node_visitor -->|"browses"| node_public_pages
node_visitor -->|"uses"| node_customer_pages
node_page_app -->|"calls"| node_api_client
node_login_ui -->|"calls"| node_api_client
node_shared_layout -->|"calls"| node_api_client
node_form_ui -.->|"validates forms"| node_customer_pages
node_api_client -.->|"sends requests"| node_api_server
node_http_server -->|"listens with"| node_api_server
node_api_server -->|"mounts"| node_auth_routes
node_api_server -->|"mounts"| node_banking_routes
node_api_server -->|"queries health"| node_db_pool
node_api_server -->|"configures"| node_configuration
node_auth_routes -->|"protects routes"| node_session_guard
node_banking_routes -->|"guards routes"| node_session_guard
node_auth_routes -->|"reads and writes"| node_db_pool
node_banking_routes -->|"reads and writes"| node_db_pool
node_auth_routes -->|"validates input"| node_validation
node_banking_routes -->|"validates input"| node_validation
node_db_pool -->|"uses settings"| node_configuration
node_db_pool -.->|"queries"| node_mysql
node_api_server -.->|"stores sessions"| node_mysql

click node_public_pages "https://github.com/rahuljko1/bank-management-system/tree/main/pages"
click node_customer_pages "https://github.com/rahuljko1/bank-management-system/tree/main/pages"
click node_page_app "https://github.com/rahuljko1/bank-management-system/blob/main/js/page-app.js"
click node_login_ui "https://github.com/rahuljko1/bank-management-system/blob/main/js/login.js"
click node_shared_layout "https://github.com/rahuljko1/bank-management-system/blob/main/js/shared-layout.js"
click node_form_ui "https://github.com/rahuljko1/bank-management-system/blob/main/js/ui.js"
click node_api_client "https://github.com/rahuljko1/bank-management-system/blob/main/js/api.js"
click node_api_server "https://github.com/rahuljko1/bank-management-system/blob/main/server/src/app.js"
click node_auth_routes "https://github.com/rahuljko1/bank-management-system/blob/main/server/src/routes/auth.js"
click node_session_guard "https://github.com/rahuljko1/bank-management-system/blob/main/server/src/middleware/session-user.js"
click node_banking_routes "https://github.com/rahuljko1/bank-management-system/blob/main/server/src/routes/banking.js"
click node_validation "https://github.com/rahuljko1/bank-management-system/blob/main/server/src/utils/validation.js"
click node_db_pool "https://github.com/rahuljko1/bank-management-system/blob/main/server/src/db.js"
click node_mysql "https://github.com/rahuljko1/bank-management-system/blob/main/server/sql/schema.sql"
click node_configuration "https://github.com/rahuljko1/bank-management-system/blob/main/server/src/config.js"
click node_http_server "https://github.com/rahuljko1/bank-management-system/blob/main/server/src/server.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_public_pages,node_customer_pages,node_page_app,node_login_ui,node_shared_layout,node_form_ui,node_api_client toneBlue
class node_auth_routes,node_session_guard toneAmber
class node_banking_routes,node_validation toneMint
class node_api_server,node_db_pool,node_mysql,node_configuration,node_http_server toneRose
class node_visitor toneIndigo
```

## Components

### Browser experience

- [Public banking pages](https://github.com/rahuljko1/bank-management-system/tree/main/pages): `pages`
- [Customer pages](https://github.com/rahuljko1/bank-management-system/tree/main/pages): `pages`
- [Page workflows](https://github.com/rahuljko1/bank-management-system/blob/main/js/page-app.js): `js/page-app.js`
- [Login forms](https://github.com/rahuljko1/bank-management-system/blob/main/js/login.js): `js/login.js`
- [Shared layout](https://github.com/rahuljko1/bank-management-system/blob/main/js/shared-layout.js): `js/shared-layout.js`
- [Form validation](https://github.com/rahuljko1/bank-management-system/blob/main/js/ui.js): `js/ui.js`
- [API client](https://github.com/rahuljko1/bank-management-system/blob/main/js/api.js): `js/api.js`

### Identity and sessions

- [Authentication routes](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/routes/auth.js): `server/src/routes/auth.js`
- [Session guard](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/middleware/session-user.js): `server/src/middleware/session-user.js`

### Banking operations

- [Banking routes](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/routes/banking.js): `server/src/routes/banking.js`
- [Input validation](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/utils/validation.js): `server/src/utils/validation.js`

### API and persistence

- [Banking API](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/app.js): `server/src/app.js`
- [Database pool](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/db.js): `server/src/db.js`
- [MySQL data store](https://github.com/rahuljko1/bank-management-system/blob/main/server/sql/schema.sql): `server/sql/schema.sql`
- [Runtime configuration](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/config.js): `server/src/config.js`
- [HTTP listener](https://github.com/rahuljko1/bank-management-system/blob/main/server/src/server.js): `server/src/server.js`

### Other components

- **Bank customer**

## Connections

- Bank customer → Public banking pages: browses
- Bank customer → Customer pages: uses
- Page workflows → API client: calls (evidence: `js/page-app.js`)
- Login forms → API client: calls (evidence: `js/login.js`)
- Shared layout → API client: calls (evidence: `js/shared-layout.js`)
- Form validation → Customer pages: validates forms
- API client → Banking API: sends requests
- HTTP listener → Banking API: listens with (evidence: `server/src/server.js`)
- Banking API → Authentication routes: mounts (evidence: `server/src/app.js`)
- Banking API → Banking routes: mounts (evidence: `server/src/app.js`)
- Banking API → Database pool: queries health (evidence: `server/src/app.js`)
- Banking API → Runtime configuration: configures (evidence: `server/src/app.js`)
- Authentication routes → Session guard: protects routes (evidence: `server/src/routes/auth.js`)
- Banking routes → Session guard: guards routes (evidence: `server/src/routes/banking.js`)
- Authentication routes → Database pool: reads and writes (evidence: `server/src/routes/auth.js`)
- Banking routes → Database pool: reads and writes (evidence: `server/src/routes/banking.js`)
- Authentication routes → Input validation: validates input (evidence: `server/src/routes/auth.js`)
- Banking routes → Input validation: validates input (evidence: `server/src/routes/banking.js`)
- Database pool → Runtime configuration: uses settings (evidence: `server/src/db.js`)
- Database pool → MySQL data store: queries
- Banking API → MySQL data store: stores sessions
