# subhankar-roy06/banking-backend architecture

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

- Interactive diagram: https://gitdiagram.com/subhankar-roy06/banking-backend
- Repository: https://github.com/subhankar-roy06/banking-backend

## Overview

This is a small Express backend centered on account registration. An HTTP client reaches the server, which mounts the authentication routes; the registration controller checks for an existing email and creates a user through the Mongoose model. The model validates account fields and hashes passwords with bcrypt. The server also initiates a MongoDB connection. The excerpts show no registration response after creation, login route, or JWT use, so those behaviors are not represented.

Main entry points: [`backend/server.js`](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/server.js) (Backend server), [`backend/src/app.js`](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/app.js) (Express app), [`backend/src/routes/auth.routes.js`](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/routes/auth.routes.js) (Auth routes), [`backend/src/controllers/auth.controller.js`](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/controllers/auth.controller.js) (Registration controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_server["Backend server<br/>[server.js]"]
  node_app["Express app<br/>[app.js]"]
end

subgraph group_auth["Authentication"]
  node_routes["Auth routes<br/>[auth.routes.js]"]
  node_register["Registration controller<br/>[auth.controller.js]"]
end

subgraph group_persistence["Persistence"]
  node_user["User model<br/>[user.model.js]"]
  node_bcrypt["Password hashing<br/>[user.model.js]"]
  node_dbconfig["DB connection<br/>[db.js]"]
end

node_client(("HTTP client"))
node_mongodb[("MongoDB")]

node_client -->|"sends HTTP"| node_server
node_server -->|"starts listener"| node_app
node_server -->|"connects database"| node_dbconfig
node_app -->|"mounts routes"| node_routes
node_routes -->|"dispatches registration"| node_register
node_register -->|"checks and creates"| node_user
node_user -->|"hashes passwords"| node_bcrypt
node_dbconfig -->|"connects"| node_mongodb

click node_server "https://github.com/subhankar-roy06/banking-backend/blob/main/backend/server.js"
click node_app "https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/app.js"
click node_routes "https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/routes/auth.routes.js"
click node_register "https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/controllers/auth.controller.js"
click node_user "https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/models/user.model.js"
click node_bcrypt "https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/models/user.model.js"
click node_dbconfig "https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/config/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_server,node_app,node_client toneBlue
class node_routes,node_register,node_mongodb toneAmber
class node_user,node_bcrypt,node_dbconfig toneMint
```

## Components

### Server runtime

- [Backend server](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/server.js): `backend/server.js`
- [Express app](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/app.js): `backend/src/app.js`

### Authentication

- [Auth routes](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Registration controller](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`

### Persistence

- [User model](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/models/user.model.js): `backend/src/models/user.model.js`
- [Password hashing](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/models/user.model.js): `backend/src/models/user.model.js`
- [DB connection](https://github.com/subhankar-roy06/banking-backend/blob/main/backend/src/config/db.js): `backend/src/config/db.js`

### Other components

- **HTTP client**
- **MongoDB**

## Connections

- HTTP client → Backend server: sends HTTP (evidence: `backend/server.js`)
- Backend server → Express app: starts listener (evidence: `backend/server.js`)
- Backend server → DB connection: connects database (evidence: `backend/server.js`)
- Express app → Auth routes: mounts routes (evidence: `backend/src/app.js`)
- Auth routes → Registration controller: dispatches registration (evidence: `backend/src/routes/auth.routes.js`)
- Registration controller → User model: checks and creates (evidence: `backend/src/controllers/auth.controller.js`)
- User model → Password hashing: hashes passwords (evidence: `backend/src/models/user.model.js`)
- DB connection → MongoDB: connects (evidence: `backend/src/config/db.js`)
