# scarlet70/fundar-app architecture

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

- Interactive diagram: https://gitdiagram.com/scarlet70/fundar-app
- Repository: https://github.com/scarlet70/fundar-app

## Overview

Fundar is a personal-finance budgeting app: users create an account, enter income, configure allocations, and review dashboard and analytics views. The frontend routes those experiences; the backend provides authentication and income, user, and settings endpoints backed by models. The sampled code confirms route/controller and controller/model relationships, but does not show page-to-API calls or database wiring in detail, so those connections are left unverified.

Main entry points: [`frontend/src/App.tsx`](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/App.tsx) (Route application), [`backend/src/app.ts`](https://github.com/scarlet70/fundar-app/blob/main/backend/src/app.ts) (API application), [`backend/src/controllers/authController.ts`](https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/authController.ts) (Authentication), [`backend/src/controllers/userController.ts`](https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/userController.ts) (User operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Route application<br/>[App.tsx]"]
  node_auth_pages["Sign-in pages<br/>[LoginPage.tsx]"]
  node_guard["Protected routes<br/>[ProtectedRoute.tsx]"]
  node_dashboard["Budget dashboard<br/>[Dashboard.tsx]"]
  node_income_page["Income entry<br/>[IncomePage.tsx]"]
  node_allocation_page["Allocations"]
  node_analytics["Financial analytics<br/>[AnalyticsPage.tsx]"]
  node_settings_page["User settings<br/>[Settings.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_auth_state["Auth session<br/>[authStore.ts]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP server<br/>[server.ts]"]
  node_express_app["API application<br/>[app.ts]"]
  node_auth_routes["Auth routes<br/>[authRoutes.ts]"]
  node_income_routes["Income routes<br/>[incomeRoutes.ts]"]
  node_user_routes["User routes<br/>[userRoutes.ts]"]
  node_settings_routes["Settings routes<br/>[settingsRoutes.ts]"]
end

subgraph group_domain["Finance and identity"]
  node_auth_controller["Authentication<br/>[authController.ts]"]
  node_income_controller["Income operations"]
  node_user_controller["User operations<br/>[userController.ts]"]
  node_settings_controller["Settings operations"]
  node_auth_middleware["Token authorization<br/>[authMiddleware.ts]"]
  node_user_model[("User records<br/>[userModel.ts]")]
  node_income_model[("Income records<br/>[incomeModel.ts]")]
  node_settings_model[("Settings records<br/>[settingsModel.ts]")]
end

subgraph group_runtime["Runtime services"]
  node_database_config["Database connection<br/>[connectDB.ts]"]
  node_email_service["Email provider"]
  node_error_handler["Error handling<br/>[errorController.ts]"]
  node_http_transport["HTTP transport"]
end

node_visitor(("User"))

node_visitor -->|"uses"| node_app
node_app -->|"routes"| node_auth_pages
node_app -->|"protects"| node_guard
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_income_page
node_app -->|"routes"| node_allocation_page
node_app -->|"routes"| node_analytics
node_app -->|"routes"| node_settings_page
node_api_client -.->|"sends requests"| node_http_transport
node_http_transport -.->|"delivers requests"| node_express_app
node_server -->|"starts"| node_express_app
node_server -->|"connects database"| node_database_config
node_express_app -->|"mounts routes"| node_auth_routes
node_express_app -->|"mounts routes"| node_income_routes
node_express_app -->|"mounts routes"| node_user_routes
node_express_app -->|"mounts routes"| node_settings_routes
node_express_app -->|"protects requests"| node_auth_middleware
node_express_app -->|"handles errors"| node_error_handler
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"uses protection"| node_auth_middleware
node_income_routes -->|"dispatches"| node_income_controller
node_income_routes -->|"restricts bulk"| node_auth_middleware
node_user_routes -->|"dispatches"| node_user_controller
node_settings_routes -->|"dispatches"| node_settings_controller
node_auth_controller -->|"reads and writes"| node_user_model
node_auth_controller -->|"reads and writes"| node_settings_model
node_auth_controller -->|"sends reset email"| node_email_service
node_auth_middleware -->|"loads user"| node_user_model
node_income_controller -->|"reads and writes"| node_income_model
node_user_controller -->|"reads and writes"| node_user_model
node_user_controller -->|"loads settings"| node_settings_model
node_user_controller -->|"sends notice"| node_email_service
node_settings_controller -->|"reads and writes"| node_settings_model
node_user_model -.->|"uses database"| node_database_config
node_income_model -.->|"uses database"| node_database_config
node_settings_model -.->|"uses database"| node_database_config

click node_app "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/App.tsx"
click node_auth_pages "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/LoginPage.tsx"
click node_guard "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/ProtectedRoute.tsx"
click node_dashboard "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/Dashboard.tsx"
click node_income_page "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/IncomePage.tsx"
click node_allocation_page "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/AllocationsPage.tsx"
click node_analytics "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/AnalyticsPage.tsx"
click node_settings_page "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/Settings.tsx"
click node_api_client "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/api/api.ts"
click node_auth_state "https://github.com/scarlet70/fundar-app/blob/main/frontend/src/stores/authStore.ts"
click node_server "https://github.com/scarlet70/fundar-app/blob/main/backend/src/server.ts"
click node_express_app "https://github.com/scarlet70/fundar-app/blob/main/backend/src/app.ts"
click node_auth_routes "https://github.com/scarlet70/fundar-app/blob/main/backend/src/routes/authRoutes.ts"
click node_income_routes "https://github.com/scarlet70/fundar-app/blob/main/backend/src/routes/incomeRoutes.ts"
click node_user_routes "https://github.com/scarlet70/fundar-app/blob/main/backend/src/routes/userRoutes.ts"
click node_settings_routes "https://github.com/scarlet70/fundar-app/blob/main/backend/src/routes/settingsRoutes.ts"
click node_auth_controller "https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/authController.ts"
click node_income_controller "https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/incomeController.ts"
click node_user_controller "https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/userController.ts"
click node_settings_controller "https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/settingsController.ts"
click node_auth_middleware "https://github.com/scarlet70/fundar-app/blob/main/backend/src/middleware/authMiddleware.ts"
click node_user_model "https://github.com/scarlet70/fundar-app/blob/main/backend/src/models/userModel.ts"
click node_income_model "https://github.com/scarlet70/fundar-app/blob/main/backend/src/models/incomeModel.ts"
click node_settings_model "https://github.com/scarlet70/fundar-app/blob/main/backend/src/models/settingsModel.ts"
click node_database_config "https://github.com/scarlet70/fundar-app/blob/main/backend/src/config/connectDB.ts"
click node_error_handler "https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/errorController.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_app,node_auth_pages,node_guard,node_dashboard,node_income_page,node_allocation_page,node_analytics,node_settings_page,node_api_client,node_auth_state,node_visitor toneBlue
class node_server,node_express_app,node_auth_routes,node_income_routes,node_user_routes,node_settings_routes toneAmber
class node_auth_controller,node_income_controller,node_user_controller,node_settings_controller,node_auth_middleware,node_user_model,node_income_model,node_settings_model toneMint
class node_database_config,node_email_service,node_error_handler,node_http_transport toneRose
```

## Components

### Web application

- [Route application](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign-in pages](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [Protected routes](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/ProtectedRoute.tsx): `frontend/src/pages/ProtectedRoute.tsx`
- [Budget dashboard](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Income entry](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/IncomePage.tsx): `frontend/src/pages/IncomePage.tsx`
- [Allocations](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/AllocationsPage.tsx): `frontend/src/pages/AllocationsPage.tsx`
- [Financial analytics](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/AnalyticsPage.tsx): `frontend/src/pages/AnalyticsPage.tsx`
- [User settings](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/pages/Settings.tsx): `frontend/src/pages/Settings.tsx`
- [API client](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/api/api.ts): `frontend/src/api/api.ts`
- [Auth session](https://github.com/scarlet70/fundar-app/blob/main/frontend/src/stores/authStore.ts): `frontend/src/stores/authStore.ts`

### Backend API

- [HTTP server](https://github.com/scarlet70/fundar-app/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [API application](https://github.com/scarlet70/fundar-app/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Auth routes](https://github.com/scarlet70/fundar-app/blob/main/backend/src/routes/authRoutes.ts): `backend/src/routes/authRoutes.ts`
- [Income routes](https://github.com/scarlet70/fundar-app/blob/main/backend/src/routes/incomeRoutes.ts): `backend/src/routes/incomeRoutes.ts`
- [User routes](https://github.com/scarlet70/fundar-app/blob/main/backend/src/routes/userRoutes.ts): `backend/src/routes/userRoutes.ts`
- [Settings routes](https://github.com/scarlet70/fundar-app/blob/main/backend/src/routes/settingsRoutes.ts): `backend/src/routes/settingsRoutes.ts`

### Finance and identity

- [Authentication](https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/authController.ts): `backend/src/controllers/authController.ts`
- [Income operations](https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/incomeController.ts): `backend/src/controllers/incomeController.ts`
- [User operations](https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/userController.ts): `backend/src/controllers/userController.ts`
- [Settings operations](https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/settingsController.ts): `backend/src/controllers/settingsController.ts`
- [Token authorization](https://github.com/scarlet70/fundar-app/blob/main/backend/src/middleware/authMiddleware.ts): `backend/src/middleware/authMiddleware.ts`
- [User records](https://github.com/scarlet70/fundar-app/blob/main/backend/src/models/userModel.ts): `backend/src/models/userModel.ts`
- [Income records](https://github.com/scarlet70/fundar-app/blob/main/backend/src/models/incomeModel.ts): `backend/src/models/incomeModel.ts`
- [Settings records](https://github.com/scarlet70/fundar-app/blob/main/backend/src/models/settingsModel.ts): `backend/src/models/settingsModel.ts`

### Runtime services

- [Database connection](https://github.com/scarlet70/fundar-app/blob/main/backend/src/config/connectDB.ts): `backend/src/config/connectDB.ts`
- **Email provider**
- [Error handling](https://github.com/scarlet70/fundar-app/blob/main/backend/src/controllers/errorController.ts): `backend/src/controllers/errorController.ts`
- **HTTP transport**

### Other components

- **User**

## Connections

- User → Route application: uses
- Route application → Sign-in pages: routes (evidence: `frontend/src/App.tsx`)
- Route application → Protected routes: protects (evidence: `frontend/src/App.tsx`)
- Route application → Budget dashboard: routes (evidence: `frontend/src/App.tsx`)
- Route application → Income entry: routes (evidence: `frontend/src/App.tsx`)
- Route application → Allocations: routes (evidence: `frontend/src/App.tsx`)
- Route application → Financial analytics: routes (evidence: `frontend/src/App.tsx`)
- Route application → User settings: routes (evidence: `frontend/src/App.tsx`)
- API client → HTTP transport: sends requests
- HTTP transport → API application: delivers requests
- HTTP server → API application: starts (evidence: `backend/src/server.ts`)
- HTTP server → Database connection: connects database (evidence: `backend/src/server.ts`)
- API application → Auth routes: mounts routes (evidence: `backend/src/app.ts`)
- API application → Income routes: mounts routes (evidence: `backend/src/app.ts`)
- API application → User routes: mounts routes (evidence: `backend/src/app.ts`)
- API application → Settings routes: mounts routes (evidence: `backend/src/app.ts`)
- API application → Token authorization: protects requests (evidence: `backend/src/app.ts`)
- API application → Error handling: handles errors (evidence: `backend/src/app.ts`)
- Auth routes → Authentication: dispatches (evidence: `backend/src/routes/authRoutes.ts`)
- Auth routes → Token authorization: uses protection (evidence: `backend/src/routes/authRoutes.ts`)
- Income routes → Income operations: dispatches (evidence: `backend/src/routes/incomeRoutes.ts`)
- Income routes → Token authorization: restricts bulk (evidence: `backend/src/routes/incomeRoutes.ts`)
- User routes → User operations: dispatches (evidence: `backend/src/routes/userRoutes.ts`)
- Settings routes → Settings operations: dispatches (evidence: `backend/src/routes/settingsRoutes.ts`)
- Authentication → User records: reads and writes (evidence: `backend/src/controllers/authController.ts`)
- Authentication → Settings records: reads and writes (evidence: `backend/src/controllers/authController.ts`)
- Authentication → Email provider: sends reset email (evidence: `backend/src/controllers/authController.ts`)
- Token authorization → User records: loads user (evidence: `backend/src/middleware/authMiddleware.ts`)
- Income operations → Income records: reads and writes (evidence: `backend/src/controllers/incomeController.ts`)
- User operations → User records: reads and writes (evidence: `backend/src/controllers/userController.ts`)
- User operations → Settings records: loads settings (evidence: `backend/src/controllers/userController.ts`)
- User operations → Email provider: sends notice (evidence: `backend/src/controllers/userController.ts`)
- Settings operations → Settings records: reads and writes (evidence: `backend/src/controllers/settingsController.ts`)
- User records → Database connection: uses database
- Income records → Database connection: uses database
- Settings records → Database connection: uses database
