# nuelstarkops/web-x-db_bastion-admin architecture

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

- Interactive diagram: https://gitdiagram.com/nuelstarkops/web-x-db_bastion-admin
- Repository: https://github.com/nuelstarkops/web-x-db_bastion-admin

## Overview

This repository demonstrates a browser-based signup/login product backed by AWS Lambda and a private MariaDB database. The user submits credentials through the static frontend; API Gateway routes requests to the signup or login handler, which uses the database connection module and returns an HTTP response. The README also documents S3/CloudFront hosting and the VPC, subnet, gateway, route-table, and bastion setup. Those infrastructure relationships are documented rather than implemented in sampled source, so their edges cite the README.

Main entry points: [`README.md`](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md) (API Gateway), [`backend/login.js`](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/login.js) (Login handler), [`backend/signup.js`](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/signup.js) (Signup handler), [`frontend/auth.js`](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/frontend/auth.js) (Login and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_frontend["Login and signup<br/>[auth.js]"]
  node_browser_state[("Browser token state<br/>[auth.js]")]
end

subgraph group_api["Authentication API"]
  node_gateway{{"API Gateway<br/>[README.md]"}}
  node_login["Login handler<br/>[login.js]"]
  node_signup["Signup handler<br/>[signup.js]"]
  node_responses["HTTP responses<br/>[utils.js]"]
end

subgraph group_data["User data"]
  node_db_pool["DB connection pool<br/>[db.js]"]
  node_user_store[("MariaDB user store<br/>[README.md]")]
end

subgraph group_network["Private network"]
  node_vpc{{"VPC<br/>[README.md]"}}
  node_subnets["Public and private subnets<br/>[README.md]"]
  node_gateways_routes["Gateways and routes<br/>[README.md]"]
  node_bastion["Bastion host<br/>[README.md]"]
  node_db_ec2["Private DB EC2<br/>[README.md]"]
end

subgraph group_hosting["Web hosting"]
  node_static_hosting["S3 and CloudFront<br/>[README.md]"]
end

node_visitor(("Visitor"))

node_visitor -->|"submits credentials"| node_frontend
node_frontend -->|"posts requests"| node_gateway
node_gateway -->|"routes login"| node_login
node_gateway -->|"routes signup"| node_signup
node_login -->|"gets connection"| node_db_pool
node_signup -->|"gets connection"| node_db_pool
node_login -->|"reads users"| node_user_store
node_signup -->|"checks and inserts"| node_user_store
node_db_pool -->|"connects to"| node_user_store
node_login -->|"builds responses"| node_responses
node_signup -->|"builds responses"| node_responses
node_frontend -->|"stores or clears token"| node_browser_state
node_frontend -->|"served by"| node_static_hosting
node_vpc -->|"contains"| node_subnets
node_subnets -->|"uses routes"| node_gateways_routes
node_subnets -->|"public subnet hosts"| node_bastion
node_subnets -->|"private subnet hosts"| node_db_ec2
node_bastion -->|"provides SSH access"| node_db_ec2
node_db_ec2 -->|"runs database"| node_user_store
node_gateway -.->|"HTTP API integration"| node_login
node_gateway -.->|"HTTP API integration"| node_signup

click node_frontend "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/frontend/auth.js"
click node_browser_state "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/frontend/auth.js"
click node_gateway "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md"
click node_login "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/login.js"
click node_signup "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/signup.js"
click node_responses "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/utils.js"
click node_db_pool "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/db.js"
click node_user_store "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md"
click node_vpc "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md"
click node_subnets "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md"
click node_gateways_routes "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md"
click node_bastion "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md"
click node_db_ec2 "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md"
click node_static_hosting "https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md"

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_state toneBlue
class node_gateway,node_login,node_signup,node_responses toneAmber
class node_db_pool,node_user_store toneMint
class node_vpc,node_subnets,node_gateways_routes,node_bastion,node_db_ec2 toneRose
class node_static_hosting,node_visitor toneIndigo
```

## Components

### Web client

- [Login and signup](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/frontend/auth.js): `frontend/auth.js`
- [Browser token state](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/frontend/auth.js): `frontend/auth.js`

### Authentication API

- [API Gateway](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md): `README.md`
- [Login handler](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/login.js): `backend/login.js`
- [Signup handler](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/signup.js): `backend/signup.js`
- [HTTP responses](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/utils.js): `backend/utils.js`

### User data

- [DB connection pool](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/backend/db.js): `backend/db.js`
- [MariaDB user store](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md): `README.md`

### Private network

- [VPC](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md): `README.md`
- [Public and private subnets](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md): `README.md`
- [Gateways and routes](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md): `README.md`
- [Bastion host](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md): `README.md`
- [Private DB EC2](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md): `README.md`

### Web hosting

- [S3 and CloudFront](https://github.com/nuelstarkops/web-x-db_bastion-admin/blob/main/README.md): `README.md`

### Other components

- **Visitor**

## Connections

- Visitor → Login and signup: submits credentials (evidence: `frontend/auth.js`)
- Login and signup → API Gateway: posts requests (evidence: `frontend/auth.js`)
- API Gateway → Login handler: routes login (evidence: `README.md`)
- API Gateway → Signup handler: routes signup (evidence: `README.md`)
- Login handler → DB connection pool: gets connection (evidence: `backend/login.js`)
- Signup handler → DB connection pool: gets connection (evidence: `backend/signup.js`)
- Login handler → MariaDB user store: reads users (evidence: `backend/login.js`)
- Signup handler → MariaDB user store: checks and inserts (evidence: `backend/signup.js`)
- DB connection pool → MariaDB user store: connects to (evidence: `README.md`)
- Login handler → HTTP responses: builds responses (evidence: `backend/login.js`)
- Signup handler → HTTP responses: builds responses (evidence: `backend/signup.js`)
- Login and signup → Browser token state: stores or clears token (evidence: `frontend/auth.js`)
- Login and signup → S3 and CloudFront: served by (evidence: `README.md`)
- VPC → Public and private subnets: contains (evidence: `README.md`)
- Public and private subnets → Gateways and routes: uses routes (evidence: `README.md`)
- Public and private subnets → Bastion host: public subnet hosts (evidence: `README.md`)
- Public and private subnets → Private DB EC2: private subnet hosts (evidence: `README.md`)
- Bastion host → Private DB EC2: provides SSH access (evidence: `README.md`)
- Private DB EC2 → MariaDB user store: runs database (evidence: `README.md`)
- API Gateway → Login handler: HTTP API integration
- API Gateway → Signup handler: HTTP API integration
