# vidhuson/retail-banking-backend architecture

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

- Interactive diagram: https://gitdiagram.com/vidhuson/retail-banking-backend
- Repository: https://github.com/vidhuson/retail-banking-backend

## Overview

Retail Banking Backend is an Express/TypeScript API for the operations portal, covering authentication and the customer, account, transaction, employee, dashboard, notification, support, and statement domains. The request path begins at the server’s mounted routes, applies authentication, role checks and validation where configured, then reaches controllers and services. Sampled services use repositories and shared Prisma/database, audit, notification, and request-context facilities. The README documents the wider capability set; unsampled domain internals are represented by their exact service paths, with no inferred call edges.

Main entry points: [`src/services/auth.service.ts`](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/auth.service.ts) (Authentication), [`src/services/account.service.ts`](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/account.service.ts) (Account management), [`src/services/transaction.service.ts`](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/transaction.service.ts) (Transactions), [`src/routes`](https://github.com/vidhuson/retail-banking-backend/tree/main/src/routes) (Domain routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry and access"]
  node_server["Express server<br/>[server.ts]"]
  node_routes["Domain routes"]
  node_access["Access middleware"]
end

subgraph group_identity["Identity and customers"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_users["User repository<br/>[user.repository.ts]"]
  node_customers["Customer management"]
  node_customerdata["Customer repository"]
end

subgraph group_banking["Banking operations"]
  node_accounts["Account management<br/>[account.service.ts]"]
  node_accountdata["Account repository"]
  node_transactions["Transactions"]
  node_transactiondata["Transaction repository"]
  node_statements["Statements"]
end

subgraph group_operations["Portal operations"]
  node_employees["Employee management"]
  node_dashboard["Dashboard"]
  node_notifications["Notifications"]
  node_support["Support<br/>[support.service.ts]"]
  node_audit["Audit logging"]
  node_profiles["Customer profiles<br/>[profile.service.ts]"]
end

subgraph group_shared["Shared runtime"]
  node_sharedruntime["Request and response utilities<br/>[request-context.ts]"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
end

node_caller(("API clients"))
node_database[("PostgreSQL")]

node_caller -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_routes
node_routes -->|"applies access checks"| node_access
node_routes -->|"dispatches customer calls"| node_customers
node_routes -->|"dispatches account calls"| node_accounts
node_auth -->|"uses"| node_users
node_auth -->|"creates customer"| node_customerdata
node_auth -->|"creates notification"| node_notifications
node_auth -->|"logs events"| node_audit
node_customers -->|"uses"| node_customerdata
node_accounts -->|"uses"| node_accountdata
node_accounts -->|"uses"| node_customerdata
node_accounts -->|"logs events"| node_audit
node_accounts -->|"creates notifications"| node_notifications
node_transactions -->|"uses"| node_accountdata
node_transactions -->|"uses"| node_transactiondata
node_transactions -->|"logs events"| node_audit
node_transactions -->|"creates notifications"| node_notifications
node_users -->|"queries"| node_prisma
node_customerdata -->|"queries"| node_prisma
node_prisma -->|"accesses"| node_database
node_auth -.->|"uses request context"| node_sharedruntime

click node_server "https://github.com/vidhuson/retail-banking-backend/blob/main/src/server.ts"
click node_routes "https://github.com/vidhuson/retail-banking-backend/tree/main/src/routes"
click node_access "https://github.com/vidhuson/retail-banking-backend/tree/main/src/middleware"
click node_auth "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/auth.service.ts"
click node_users "https://github.com/vidhuson/retail-banking-backend/blob/main/src/repositories/user.repository.ts"
click node_customers "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/customer.service.ts"
click node_customerdata "https://github.com/vidhuson/retail-banking-backend/blob/main/src/repositories/customer.repository.ts"
click node_accounts "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/account.service.ts"
click node_accountdata "https://github.com/vidhuson/retail-banking-backend/blob/main/src/repositories/account.repository.ts"
click node_transactions "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/transaction.service.ts"
click node_transactiondata "https://github.com/vidhuson/retail-banking-backend/blob/main/src/repositories/transaction.repository.ts"
click node_statements "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/statement.service.ts"
click node_employees "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/employee.service.ts"
click node_dashboard "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/dashboard.service.ts"
click node_notifications "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/notification.service.ts"
click node_support "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/support.service.ts"
click node_audit "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/audit-log.service.ts"
click node_profiles "https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/profile.service.ts"
click node_sharedruntime "https://github.com/vidhuson/retail-banking-backend/blob/main/src/context/request-context.ts"
click node_prisma "https://github.com/vidhuson/retail-banking-backend/blob/main/src/config/prisma.ts"

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_routes,node_access,node_caller toneBlue
class node_auth,node_users,node_customers,node_customerdata,node_database toneAmber
class node_accounts,node_accountdata,node_transactions,node_transactiondata,node_statements toneMint
class node_employees,node_dashboard,node_notifications,node_support,node_audit,node_profiles toneRose
class node_sharedruntime,node_prisma toneIndigo
```

## Components

### API entry and access

- [Express server](https://github.com/vidhuson/retail-banking-backend/blob/main/src/server.ts): `src/server.ts`
- [Domain routes](https://github.com/vidhuson/retail-banking-backend/tree/main/src/routes): `src/routes`
- [Access middleware](https://github.com/vidhuson/retail-banking-backend/tree/main/src/middleware): `src/middleware`

### Identity and customers

- [Authentication](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/auth.service.ts): `src/services/auth.service.ts`
- [User repository](https://github.com/vidhuson/retail-banking-backend/blob/main/src/repositories/user.repository.ts): `src/repositories/user.repository.ts`
- [Customer management](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/customer.service.ts): `src/services/customer.service.ts`
- [Customer repository](https://github.com/vidhuson/retail-banking-backend/blob/main/src/repositories/customer.repository.ts): `src/repositories/customer.repository.ts`

### Banking operations

- [Account management](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/account.service.ts): `src/services/account.service.ts`
- [Account repository](https://github.com/vidhuson/retail-banking-backend/blob/main/src/repositories/account.repository.ts): `src/repositories/account.repository.ts`
- [Transactions](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/transaction.service.ts): `src/services/transaction.service.ts`
- [Transaction repository](https://github.com/vidhuson/retail-banking-backend/blob/main/src/repositories/transaction.repository.ts): `src/repositories/transaction.repository.ts`
- [Statements](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/statement.service.ts): `src/services/statement.service.ts`

### Portal operations

- [Employee management](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/employee.service.ts): `src/services/employee.service.ts`
- [Dashboard](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/dashboard.service.ts): `src/services/dashboard.service.ts`
- [Notifications](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/notification.service.ts): `src/services/notification.service.ts`
- [Support](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/support.service.ts): `src/services/support.service.ts`
- [Audit logging](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/audit-log.service.ts): `src/services/audit-log.service.ts`
- [Customer profiles](https://github.com/vidhuson/retail-banking-backend/blob/main/src/services/profile.service.ts): `src/services/profile.service.ts`

### Shared runtime

- [Request and response utilities](https://github.com/vidhuson/retail-banking-backend/blob/main/src/context/request-context.ts): `src/context/request-context.ts`
- [Prisma client](https://github.com/vidhuson/retail-banking-backend/blob/main/src/config/prisma.ts): `src/config/prisma.ts`

### Other components

- **API clients**
- **PostgreSQL**

## Connections

- API clients → Express server: sends requests (evidence: `README.md`)
- Express server → Domain routes: mounts routes (evidence: `src/server.ts`)
- Domain routes → Access middleware: applies access checks (evidence: `src/routes/customer.routes.ts`)
- Domain routes → Customer management: dispatches customer calls (evidence: `src/routes/customer.routes.ts`)
- Domain routes → Account management: dispatches account calls (evidence: `src/routes/account.routes.ts`)
- Authentication → User repository: uses (evidence: `src/services/auth.service.ts`)
- Authentication → Customer repository: creates customer (evidence: `src/services/auth.service.ts`)
- Authentication → Notifications: creates notification (evidence: `src/services/auth.service.ts`)
- Authentication → Audit logging: logs events (evidence: `src/services/auth.service.ts`)
- Customer management → Customer repository: uses (evidence: `src/services/customer.service.ts`)
- Account management → Account repository: uses (evidence: `src/services/account.service.ts`)
- Account management → Customer repository: uses (evidence: `src/services/account.service.ts`)
- Account management → Audit logging: logs events (evidence: `src/services/account.service.ts`)
- Account management → Notifications: creates notifications (evidence: `src/services/account.service.ts`)
- Transactions → Account repository: uses (evidence: `src/services/transaction.service.ts`)
- Transactions → Transaction repository: uses (evidence: `src/services/transaction.service.ts`)
- Transactions → Audit logging: logs events (evidence: `src/services/transaction.service.ts`)
- Transactions → Notifications: creates notifications (evidence: `src/services/transaction.service.ts`)
- User repository → Prisma client: queries (evidence: `src/repositories/user.repository.ts`)
- Customer repository → Prisma client: queries (evidence: `src/repositories/customer.repository.ts`)
- Prisma client → PostgreSQL: accesses (evidence: `src/config/prisma.ts`)
- Authentication → Request and response utilities: uses request context
