# wizzyyy17/finance-web-app architecture

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

- Interactive diagram: https://gitdiagram.com/wizzyyy17/finance-web-app
- Repository: https://github.com/wizzyyy17/finance-web-app

## Overview

This is a browser-based personal-finance app: users register or log in, then manage expenses and income and view calculated savings and charts. The browser client calls authentication and expense APIs; API handlers use user and expense models backed by MongoDB. The excerpts show these domain stages and the client-side dashboard flow. Evidence is limited: the tree is flat, while server.js imports route and database paths not present in it, so those server-to-module links are not asserted.

Main entry points: [`expenses.js`](https://github.com/wizzyyy17/finance-web-app/blob/main/expenses.js) (Expense API), [`script.js`](https://github.com/wizzyyy17/finance-web-app/blob/main/script.js) (Finance UI), [`auth.js`](https://github.com/wizzyyy17/finance-web-app/blob/main/auth.js) (Authentication API), [`User.js`](https://github.com/wizzyyy17/finance-web-app/blob/main/User.js) (User records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_client["Finance UI<br/>[script.js]"]
  node_dashboard["Dashboard flow<br/>[script.js]"]
  node_expense_views["Expense views<br/>[script.js]"]
  node_charts["Expense charts<br/>[script.js]"]
end

subgraph group_api["API"]
  node_server["HTTP server<br/>[server.js]"]
  node_auth_api["Authentication API<br/>[auth.js]"]
  node_expense_api["Expense API<br/>[expenses.js]"]
end

subgraph group_identity["Identity and records"]
  node_auth_check["Token middleware<br/>[authMiddleware.js]"]
  node_user_model["User records<br/>[User.js]"]
  node_expense_model["Expense records<br/>[Expense.js]"]
end

subgraph group_persistence["Persistence"]
  node_db_connector["Mongo connector<br/>[db.js]"]
end

node_user(("User"))
node_mongo[("MongoDB")]

node_user -->|"uses"| node_client
node_client -.->|"HTTP requests"| node_server
node_client -.->|"auth requests"| node_auth_api
node_client -.->|"expense requests"| node_expense_api
node_client -->|"loads"| node_dashboard
node_dashboard -->|"renders"| node_expense_views
node_dashboard -->|"builds"| node_charts
node_dashboard -.->|"fetches expenses"| node_expense_api
node_dashboard -.->|"fetches income"| node_expense_api
node_auth_api -->|"reads and saves"| node_user_model
node_expense_api -->|"guards routes"| node_auth_check
node_expense_api -->|"reads and writes"| node_expense_model
node_expense_api -->|"reads and updates"| node_user_model
node_db_connector -->|"connects"| node_mongo

click node_client "https://github.com/wizzyyy17/finance-web-app/blob/main/script.js"
click node_dashboard "https://github.com/wizzyyy17/finance-web-app/blob/main/script.js"
click node_expense_views "https://github.com/wizzyyy17/finance-web-app/blob/main/script.js"
click node_charts "https://github.com/wizzyyy17/finance-web-app/blob/main/script.js"
click node_server "https://github.com/wizzyyy17/finance-web-app/blob/main/server.js"
click node_auth_api "https://github.com/wizzyyy17/finance-web-app/blob/main/auth.js"
click node_expense_api "https://github.com/wizzyyy17/finance-web-app/blob/main/expenses.js"
click node_auth_check "https://github.com/wizzyyy17/finance-web-app/blob/main/authMiddleware.js"
click node_user_model "https://github.com/wizzyyy17/finance-web-app/blob/main/User.js"
click node_expense_model "https://github.com/wizzyyy17/finance-web-app/blob/main/Expense.js"
click node_db_connector "https://github.com/wizzyyy17/finance-web-app/blob/main/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_client,node_dashboard,node_expense_views,node_charts,node_user toneBlue
class node_server,node_auth_api,node_expense_api,node_mongo toneAmber
class node_auth_check,node_user_model,node_expense_model toneMint
class node_db_connector toneRose
```

## Components

### Browser client

- [Finance UI](https://github.com/wizzyyy17/finance-web-app/blob/main/script.js): `script.js`
- [Dashboard flow](https://github.com/wizzyyy17/finance-web-app/blob/main/script.js): `script.js`
- [Expense views](https://github.com/wizzyyy17/finance-web-app/blob/main/script.js): `script.js`
- [Expense charts](https://github.com/wizzyyy17/finance-web-app/blob/main/script.js): `script.js`

### API

- [HTTP server](https://github.com/wizzyyy17/finance-web-app/blob/main/server.js): `server.js`
- [Authentication API](https://github.com/wizzyyy17/finance-web-app/blob/main/auth.js): `auth.js`
- [Expense API](https://github.com/wizzyyy17/finance-web-app/blob/main/expenses.js): `expenses.js`

### Identity and records

- [Token middleware](https://github.com/wizzyyy17/finance-web-app/blob/main/authMiddleware.js): `authMiddleware.js`
- [User records](https://github.com/wizzyyy17/finance-web-app/blob/main/User.js): `User.js`
- [Expense records](https://github.com/wizzyyy17/finance-web-app/blob/main/Expense.js): `Expense.js`

### Persistence

- [Mongo connector](https://github.com/wizzyyy17/finance-web-app/blob/main/db.js): `db.js`

### Other components

- **User**
- **MongoDB**

## Connections

- User → Finance UI: uses (evidence: `script.js`)
- Finance UI → HTTP server: HTTP requests
- Finance UI → Authentication API: auth requests
- Finance UI → Expense API: expense requests
- Finance UI → Dashboard flow: loads (evidence: `script.js`)
- Dashboard flow → Expense views: renders (evidence: `script.js`)
- Dashboard flow → Expense charts: builds (evidence: `script.js`)
- Dashboard flow → Expense API: fetches expenses
- Dashboard flow → Expense API: fetches income
- Authentication API → User records: reads and saves (evidence: `auth.js`)
- Expense API → Token middleware: guards routes (evidence: `expenses.js`)
- Expense API → Expense records: reads and writes (evidence: `expenses.js`)
- Expense API → User records: reads and updates (evidence: `expenses.js`)
- Mongo connector → MongoDB: connects (evidence: `db.js`)
