# sprints-team-13/onlinebanking architecture

> Architecture diagram of the GitHub repository sprints-team-13/onlinebanking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sprints-team-13/onlinebanking
- Repository: https://github.com/sprints-team-13/onlinebanking

## Overview

#### Purpose and runtime
MERN e-banking application with separate React frontend and Node.js backend. It supports customer account/transaction operations and a privileged admin workflow for user activation and account-request decisions. Backend starts at `src/index.js`; React starts at `frontend/src/index.js`. `Procfile` indicates deployment as a process-hosted service.

#### Client application shell and access state
`frontend/src/App.jsx` composes the application’s top-level views. Authentication/session state is centralized in `frontend/src/context/Auth-context.js`, with browser persistence handled by `frontend/src/helpers/localStorage.js`. Login and registration are distinct entry flows at `frontend/src/components/login/Login.jsx` and `frontend/src/components/register/Register.jsx`; route/view access is expected to depend on the resulting user role and activation state.

#### Role-specific dashboard boundaries
The frontend separates customer and administrator experiences:
- Customer shell: `frontend/src/Pages/UserDashboard/UserDashboard.jsx`
- Admin shell: `frontend/src/Pages/AdminPanel/AdminPanel.jsx`
- Role-specific navigation: `frontend/src/layout/sidebar/UserSidebar.jsx`, `frontend/src/layout/sidebar/AdminSidebar.jsx`

Customer pages cover overview, accounts, transfers, profile, and transactions. Admin pages cover overview, users, accounts, and transactions, preserving a clear UI boundary between self-service banking and supervisory operations.

#### Banking operations and presentation
Customer operations are staged through pages for account visibility, transaction history, and money movement: `frontend/src/Pages/UserDashboard/Accounts/Accounts.jsx`, `frontend/src/Pages/UserDashboard/Transactions/Transactions.jsx`, and `frontend/src/Pages/UserDashboard/Transfer/Transfer.jsx`. Transfer validation is defined in `frontend/src/schemas/transferSchema.js`. Reusable table, chart, and dialog components provide common rendering and action-confirmation surfaces: `frontend/src/components/table/Table.jsx`, `frontend/src/components/chart/Chart.jsx`, `frontend/src/components/dialog/Dialog.js`.

#### API access and query layer
The frontend isolates HTTP interaction behind CRUD/API utilities and hooks: `frontend/src/api/apiCrud.js`, `frontend/src/hooks/useApi.js`, and role-oriented query modules such as `frontend/src/hooks/queries/users/useGetUserAccounts.js`. Admin data retrieval is similarly segmented by domain, including `frontend/src/hooks/queries/admin/useGetUsers.js` and `frontend/src/hooks/queries/admin/useGetTransactions.js`. UI pages should consume these abstractions rather than directly own transport behavior.

#### Backend HTTP and domain control
The backend’s routing boundary is `src/routes/user.js` for customer-facing APIs and `src/routes/admin/auth.js` for admin authentication/API scope. Controllers implement domain actions: account lifecycle in `src/controllers/account.js`, monetary transaction handling in `src/controllers/transactions.js`, user operations in `src/controllers/user.js`, and admin authorization/actions in `src/controllers/admin/auth.js`. Authentication input validation is separated into `src/validators/auth.js`.

#### Persistence model and core flow
MongoDB/Mongoose-style domain models represent users, accounts, and transactions: `src/models/user.js`, `src/models/account.js`, and `src/models/transactions.js`. Primary flow is React action → API/query layer → backend route → controller → model persistence → response-driven dashboard refresh. Transaction and transfer operations are the critical integrity boundary: controllers must validate actor authorization, account state, and balances before writing transaction/account changes. The deployed application is referenced by the README as a Cyclic-hosted service.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/App.jsx) (Application shell), [`frontend/src/api/apiCrud.js`](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/api/apiCrud.js) (API and query layer), [`src/routes/user.js`](https://github.com/sprints-team-13/onlinebanking/blob/master/src/routes/user.js) (Customer API routes), [`src/controllers/admin/auth.js`](https://github.com/sprints-team-13/onlinebanking/blob/master/src/controllers/admin/auth.js) (User and admin control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_frontend_boot{{"Frontend entry<br/>React runtime<br/>[index.js]"}}
  node_app_shell["Application shell<br/>React composition<br/>[App.jsx]"]
  node_auth_state["Auth session state<br/>React context<br/>[Auth-context.js]"]
  node_browser_storage["Browser session storage<br/>storage helper<br/>[localStorage.js]"]
  node_auth_entry["Login and registration<br/>auth views<br/>[Login.jsx]"]
  node_customer_dashboard["Customer dashboard<br/>customer shell<br/>[UserDashboard.jsx]"]
  node_admin_panel["Admin panel<br/>admin shell<br/>[AdminPanel.jsx]"]
  node_customer_operations["Accounts, transfers, history<br/>customer pages<br/>[Transfer.jsx]"]
  node_transfer_validation["Transfer validation<br/>validation schema<br/>[transferSchema.js]"]
  node_admin_queries["Admin data views<br/>admin queries<br/>[useGetUsers.js]"]
  node_api_layer["API and query layer<br/>HTTP abstraction<br/>[apiCrud.js]"]
  node_shared_ui["Tables, charts, dialogs<br/>shared UI<br/>[Table.jsx]"]
end

subgraph group_server["Node.js backend"]
  node_backend_boot{{"Backend entry<br/>Node.js runtime<br/>[index.js]"}}
  node_customer_routes["Customer API routes<br/>HTTP routes<br/>[user.js]"]
  node_admin_routes["Admin API routes<br/>HTTP routes<br/>[auth.js]"]
  node_banking_controllers["Account and transaction control<br/>domain controllers<br/>[transactions.js]"]
  node_identity_controllers["User and admin control<br/>identity controllers<br/>[auth.js]"]
  node_auth_validation["Auth validation<br/>input validation<br/>[auth.js]"]
end

subgraph group_data["MongoDB domain data"]
  node_banking_models[("Accounts and transactions<br/>Mongoose models<br/>[account.js]")]
  node_user_model[("Users<br/>Mongoose model<br/>[user.js]")]
end

node_frontend_boot -->|"mounts"| node_app_shell
node_app_shell -->|"uses"| node_auth_state
node_auth_state -->|"persists session"| node_browser_storage
node_app_shell -->|"unauthenticated access"| node_auth_entry
node_app_shell -->|"customer role"| node_customer_dashboard
node_app_shell -->|"admin role"| node_admin_panel
node_customer_dashboard -->|"hosts"| node_customer_operations
node_customer_operations -->|"validates transfers"| node_transfer_validation
node_customer_dashboard -->|"queries and actions"| node_api_layer
node_admin_panel -->|"retrieves oversight data"| node_admin_queries
node_admin_queries -->|"uses"| node_api_layer
node_customer_operations -->|"renders with"| node_shared_ui
node_api_layer -->|"customer requests"| node_customer_routes
node_api_layer -->|"admin requests"| node_admin_routes
node_backend_boot -->|"serves"| node_customer_routes
node_backend_boot -->|"serves"| node_admin_routes
node_customer_routes -->|"dispatches"| node_banking_controllers
node_customer_routes -->|"dispatches user actions"| node_identity_controllers
node_admin_routes -->|"dispatches"| node_identity_controllers
node_identity_controllers -->|"validates auth input"| node_auth_validation
node_banking_controllers -->|"reads and writes"| node_banking_models
node_banking_controllers -->|"authorizes actor"| node_user_model
node_identity_controllers -->|"manages users"| node_user_model
node_banking_models -.->|"response refreshes dashboards"| node_api_layer

click node_backend_boot "https://github.com/sprints-team-13/onlinebanking/blob/master/src/index.js"
click node_frontend_boot "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/index.js"
click node_app_shell "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/App.jsx"
click node_auth_state "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/context/Auth-context.js"
click node_browser_storage "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/helpers/localStorage.js"
click node_auth_entry "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/components/login/Login.jsx"
click node_customer_dashboard "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/Pages/UserDashboard/UserDashboard.jsx"
click node_admin_panel "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/Pages/AdminPanel/AdminPanel.jsx"
click node_customer_operations "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/Pages/UserDashboard/Transfer/Transfer.jsx"
click node_transfer_validation "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/schemas/transferSchema.js"
click node_admin_queries "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/hooks/queries/admin/useGetUsers.js"
click node_api_layer "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/api/apiCrud.js"
click node_shared_ui "https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/components/table/Table.jsx"
click node_customer_routes "https://github.com/sprints-team-13/onlinebanking/blob/master/src/routes/user.js"
click node_admin_routes "https://github.com/sprints-team-13/onlinebanking/blob/master/src/routes/admin/auth.js"
click node_banking_controllers "https://github.com/sprints-team-13/onlinebanking/blob/master/src/controllers/transactions.js"
click node_identity_controllers "https://github.com/sprints-team-13/onlinebanking/blob/master/src/controllers/admin/auth.js"
click node_auth_validation "https://github.com/sprints-team-13/onlinebanking/blob/master/src/validators/auth.js"
click node_banking_models "https://github.com/sprints-team-13/onlinebanking/blob/master/src/models/account.js"
click node_user_model "https://github.com/sprints-team-13/onlinebanking/blob/master/src/models/user.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_frontend_boot,node_app_shell,node_auth_state,node_browser_storage,node_auth_entry,node_customer_dashboard,node_admin_panel,node_customer_operations,node_transfer_validation,node_admin_queries,node_api_layer,node_shared_ui toneBlue
class node_backend_boot,node_customer_routes,node_admin_routes,node_banking_controllers,node_identity_controllers,node_auth_validation toneAmber
class node_banking_models,node_user_model toneMint
```

## Components

### React client

- [Frontend entry](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/index.js): React runtime · `frontend/src/index.js`
- [Application shell](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/App.jsx): React composition · Selects views and top-level application structure. · `frontend/src/App.jsx`
- [Auth session state](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/context/Auth-context.js): React context · Tracks session, role, and activation-dependent access. · `frontend/src/context/Auth-context.js`
- [Browser session storage](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/helpers/localStorage.js): storage helper · `frontend/src/helpers/localStorage.js`
- [Login and registration](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/components/login/Login.jsx): auth views · `frontend/src/components/login/Login.jsx`
- [Customer dashboard](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/Pages/UserDashboard/UserDashboard.jsx): customer shell · Self-service banking area with customer navigation. · `frontend/src/Pages/UserDashboard/UserDashboard.jsx`
- [Admin panel](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/Pages/AdminPanel/AdminPanel.jsx): admin shell · Supervisory area with role-specific navigation. · `frontend/src/Pages/AdminPanel/AdminPanel.jsx`
- [Accounts, transfers, history](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/Pages/UserDashboard/Transfer/Transfer.jsx): customer pages · Account visibility, money movement, and transaction history. · `frontend/src/Pages/UserDashboard/Transfer/Transfer.jsx`
- [Transfer validation](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/schemas/transferSchema.js): validation schema · `frontend/src/schemas/transferSchema.js`
- [Admin data views](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/hooks/queries/admin/useGetUsers.js): admin queries · Retrieves users and transaction data for supervision. · `frontend/src/hooks/queries/admin/useGetUsers.js`
- [API and query layer](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/api/apiCrud.js): HTTP abstraction · Pages use shared CRUD transport and query hooks. · `frontend/src/api/apiCrud.js`
- [Tables, charts, dialogs](https://github.com/sprints-team-13/onlinebanking/blob/master/frontend/src/components/table/Table.jsx): shared UI · Reusable rendering and confirmation surfaces. · `frontend/src/components/table/Table.jsx`

### Node.js backend

- [Backend entry](https://github.com/sprints-team-13/onlinebanking/blob/master/src/index.js): Node.js runtime · Starts the process-hosted API service. · `src/index.js`
- [Customer API routes](https://github.com/sprints-team-13/onlinebanking/blob/master/src/routes/user.js): HTTP routes · `src/routes/user.js`
- [Admin API routes](https://github.com/sprints-team-13/onlinebanking/blob/master/src/routes/admin/auth.js): HTTP routes · `src/routes/admin/auth.js`
- [Account and transaction control](https://github.com/sprints-team-13/onlinebanking/blob/master/src/controllers/transactions.js): domain controllers · Authorizes account state and balances before persistence changes. · `src/controllers/transactions.js`
- [User and admin control](https://github.com/sprints-team-13/onlinebanking/blob/master/src/controllers/admin/auth.js): identity controllers · Handles user operations, activation, and admin actions. · `src/controllers/admin/auth.js`
- [Auth validation](https://github.com/sprints-team-13/onlinebanking/blob/master/src/validators/auth.js): input validation · `src/validators/auth.js`

### MongoDB domain data

- [Accounts and transactions](https://github.com/sprints-team-13/onlinebanking/blob/master/src/models/account.js): Mongoose models · Persistent banking balances and transaction records. · `src/models/account.js`
- [Users](https://github.com/sprints-team-13/onlinebanking/blob/master/src/models/user.js): Mongoose model · Persistent identities, roles, and activation state. · `src/models/user.js`

## Connections

- Frontend entry → Application shell: mounts
- Application shell → Auth session state: uses
- Auth session state → Browser session storage: persists session
- Application shell → Login and registration: unauthenticated access
- Application shell → Customer dashboard: customer role
- Application shell → Admin panel: admin role
- Customer dashboard → Accounts, transfers, history: hosts
- Accounts, transfers, history → Transfer validation: validates transfers
- Customer dashboard → API and query layer: queries and actions
- Admin panel → Admin data views: retrieves oversight data
- Admin data views → API and query layer: uses
- Accounts, transfers, history → Tables, charts, dialogs: renders with
- API and query layer → Customer API routes: customer requests
- API and query layer → Admin API routes: admin requests
- Backend entry → Customer API routes: serves
- Backend entry → Admin API routes: serves
- Customer API routes → Account and transaction control: dispatches
- Customer API routes → User and admin control: dispatches user actions
- Admin API routes → User and admin control: dispatches
- User and admin control → Auth validation: validates auth input
- Account and transaction control → Accounts and transactions: reads and writes
- Account and transaction control → Users: authorizes actor
- User and admin control → Users: manages users
- Accounts and transactions → API and query layer: response refreshes dashboards
