# akagamifr/secure-bank architecture

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

## Overview

Secure Bank is a single-file banking web application: a user signs up or signs in, then uses an authenticated dashboard for account information and loan actions. The server embeds and serves the browser interface, handles API requests, and accesses PostgreSQL; multipart signup also accepts an identity image. The excerpt confirms loan history, cards, balance, and password-change interface elements, but omits their handlers and wiring, so those capabilities are not mapped as API flows.

Main entry points: [`server.js`](https://github.com/akagamifr/secure-bank/blob/master/server.js) (Banking interface), [`uploads`](https://github.com/akagamifr/secure-bank/tree/master/uploads) (Identity uploads)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_frontend["Banking interface<br/>[server.js]"]
  node_web_server["HTTP server<br/>[server.js]"]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Signup and signin<br/>[server.js]"]
  node_auth_middleware["JWT authentication<br/>[server.js]"]
end

subgraph group_banking["Banking services"]
  node_profile["User profile<br/>[server.js]"]
  node_loan["Loan actions<br/>[server.js]"]
end

node_user(("Bank user"))
node_postgres[("PostgreSQL")]
node_uploads["Identity uploads"]

node_user -->|"uses"| node_frontend
node_frontend -->|"requests pages"| node_web_server
node_web_server -->|"serves interface"| node_frontend
node_frontend -->|"submits credentials"| node_auth_routes
node_auth_routes -->|"checks and stores users"| node_postgres
node_auth_routes -->|"issues JWT"| node_auth_middleware
node_frontend -->|"requests profile"| node_profile
node_profile -->|"checks token"| node_auth_middleware
node_profile -->|"reads user"| node_postgres
node_frontend -->|"requests loan"| node_loan
node_loan -->|"checks token"| node_auth_middleware
node_loan -->|"records loan and balance"| node_postgres
node_auth_routes -.->|"references uploaded image"| node_uploads

click node_frontend "https://github.com/akagamifr/secure-bank/blob/master/server.js"
click node_web_server "https://github.com/akagamifr/secure-bank/blob/master/server.js"
click node_auth_routes "https://github.com/akagamifr/secure-bank/blob/master/server.js"
click node_auth_middleware "https://github.com/akagamifr/secure-bank/blob/master/server.js"
click node_profile "https://github.com/akagamifr/secure-bank/blob/master/server.js"
click node_loan "https://github.com/akagamifr/secure-bank/blob/master/server.js"
click node_uploads "https://github.com/akagamifr/secure-bank/tree/master/uploads"

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_frontend,node_web_server,node_user toneBlue
class node_auth_routes,node_auth_middleware,node_postgres toneAmber
class node_profile,node_loan toneMint
class node_uploads toneTeal
```

## Components

### Web interface

- [Banking interface](https://github.com/akagamifr/secure-bank/blob/master/server.js): `server.js`
- [HTTP server](https://github.com/akagamifr/secure-bank/blob/master/server.js): `server.js`

### Identity and access

- [Signup and signin](https://github.com/akagamifr/secure-bank/blob/master/server.js): `server.js`
- [JWT authentication](https://github.com/akagamifr/secure-bank/blob/master/server.js): `server.js`

### Banking services

- [User profile](https://github.com/akagamifr/secure-bank/blob/master/server.js): `server.js`
- [Loan actions](https://github.com/akagamifr/secure-bank/blob/master/server.js): `server.js`

### Other components

- **Bank user**
- **PostgreSQL**
- [Identity uploads](https://github.com/akagamifr/secure-bank/tree/master/uploads): `uploads`

## Connections

- Bank user → Banking interface: uses
- Banking interface → HTTP server: requests pages
- HTTP server → Banking interface: serves interface
- Banking interface → Signup and signin: submits credentials
- Signup and signin → PostgreSQL: checks and stores users
- Signup and signin → JWT authentication: issues JWT
- Banking interface → User profile: requests profile
- User profile → JWT authentication: checks token
- User profile → PostgreSQL: reads user
- Banking interface → Loan actions: requests loan
- Loan actions → JWT authentication: checks token
- Loan actions → PostgreSQL: records loan and balance
- Signup and signin → Identity uploads: references uploaded image
