# srguillebta/secure-demobank architecture

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

- Interactive diagram: https://gitdiagram.com/srguillebta/secure-demobank
- Repository: https://github.com/srguillebta/secure-demobank

## Overview

Secure DemoBank is a simulated digital-wallet project, but the checked-in runtime currently exposes only a health endpoint; no wallet, authentication, or transaction workflow is implemented in the sampled backend. The documented request path is browser → Nginx → FastAPI → PostgreSQL. The graph preserves the static frontend, proxy security functions, database role setup, and the backend’s settings and connection layers. Runtime wiring for several unsampled components is based on the README; source excerpts confirm the API’s health-check database access and configuration dependencies.

Main entry points: [`proxy/default.conf`](https://github.com/srguillebta/secure-demobank/blob/main/proxy/default.conf) (Nginx proxy), [`backend/app/main.py`](https://github.com/srguillebta/secure-demobank/blob/main/backend/app/main.py) (FastAPI API), [`backend/app/db.py`](https://github.com/srguillebta/secure-demobank/blob/main/backend/app/db.py) (SQLAlchemy engine), [`backend/app/config.py`](https://github.com/srguillebta/secure-demobank/blob/main/backend/app/config.py) (Settings and secrets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_frontend["Static frontend"]
end

subgraph group_edge["Proxy edge"]
  node_nginx["Nginx proxy<br/>[default.conf]"]
  node_proxy_headers["Security headers"]
  node_proxy_api["API proxy rules<br/>[proxy-backend.conf]"]
end

subgraph group_backend["Backend"]
  node_api["FastAPI API<br/>[main.py]"]
  node_settings["Settings and secrets<br/>[config.py]"]
  node_db_engine["SQLAlchemy engine<br/>[db.py]"]
end

subgraph group_storage["Database"]
  node_postgres[("PostgreSQL")]
  node_db_roles["Database roles<br/>[01-roles.sh]"]
end

node_browser(("Browser"))

node_browser -->|"requests"| node_nginx
node_nginx -.->|"serves app"| node_frontend
node_nginx -->|"proxies API"| node_api
node_nginx -.->|"applies"| node_proxy_headers
node_nginx -.->|"uses rules"| node_proxy_api
node_api -->|"loads"| node_settings
node_api -->|"checks database"| node_db_engine
node_db_engine -->|"reads URL"| node_settings
node_db_engine -->|"connects"| node_postgres
node_db_roles -->|"creates roles"| node_postgres

click node_frontend "https://github.com/srguillebta/secure-demobank/tree/main/frontend/public"
click node_nginx "https://github.com/srguillebta/secure-demobank/blob/main/proxy/default.conf"
click node_proxy_headers "https://github.com/srguillebta/secure-demobank/blob/main/proxy/snippets/security-headers.conf"
click node_proxy_api "https://github.com/srguillebta/secure-demobank/blob/main/proxy/snippets/proxy-backend.conf"
click node_api "https://github.com/srguillebta/secure-demobank/blob/main/backend/app/main.py"
click node_settings "https://github.com/srguillebta/secure-demobank/blob/main/backend/app/config.py"
click node_db_engine "https://github.com/srguillebta/secure-demobank/blob/main/backend/app/db.py"
click node_db_roles "https://github.com/srguillebta/secure-demobank/blob/main/db/init/01-roles.sh"

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_browser toneBlue
class node_nginx,node_proxy_headers,node_proxy_api toneAmber
class node_api,node_settings,node_db_engine toneMint
class node_postgres,node_db_roles toneRose
```

## Components

### Client

- [Static frontend](https://github.com/srguillebta/secure-demobank/tree/main/frontend/public): `frontend/public`

### Proxy edge

- [Nginx proxy](https://github.com/srguillebta/secure-demobank/blob/main/proxy/default.conf): `proxy/default.conf`
- [Security headers](https://github.com/srguillebta/secure-demobank/blob/main/proxy/snippets/security-headers.conf): `proxy/snippets/security-headers.conf`
- [API proxy rules](https://github.com/srguillebta/secure-demobank/blob/main/proxy/snippets/proxy-backend.conf): `proxy/snippets/proxy-backend.conf`

### Backend

- [FastAPI API](https://github.com/srguillebta/secure-demobank/blob/main/backend/app/main.py): `backend/app/main.py`
- [Settings and secrets](https://github.com/srguillebta/secure-demobank/blob/main/backend/app/config.py): `backend/app/config.py`
- [SQLAlchemy engine](https://github.com/srguillebta/secure-demobank/blob/main/backend/app/db.py): `backend/app/db.py`

### Database

- **PostgreSQL**
- [Database roles](https://github.com/srguillebta/secure-demobank/blob/main/db/init/01-roles.sh): `db/init/01-roles.sh`

### Other components

- **Browser**

## Connections

- Browser → Nginx proxy: requests (evidence: `README.md`)
- Nginx proxy → Static frontend: serves app
- Nginx proxy → FastAPI API: proxies API (evidence: `README.md`)
- Nginx proxy → Security headers: applies
- Nginx proxy → API proxy rules: uses rules
- FastAPI API → Settings and secrets: loads (evidence: `backend/app/main.py`)
- FastAPI API → SQLAlchemy engine: checks database (evidence: `backend/app/main.py`)
- SQLAlchemy engine → Settings and secrets: reads URL (evidence: `backend/app/db.py`)
- SQLAlchemy engine → PostgreSQL: connects (evidence: `README.md`)
- Database roles → PostgreSQL: creates roles (evidence: `README.md`)
