# ab7-dev/expense-tracker-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/ab7-dev/expense-tracker-dashboard
- Repository: https://github.com/ab7-dev/expense-tracker-dashboard

## Overview

Finsight is a personal finance tracker: users authenticate, record income and expenses, set category budgets, and view dashboards, trends, yearly summaries, and rule-based insights. The graph follows the frontend routes and API calls into backend routing, controllers, services, and persistence. README documents OAuth and the analytics capabilities; analytics implementation was not sampled, so those internal relationships are shown only where documented or indexed.

Main entry points: [`finsight-frontend/src/App.tsx`](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/App.tsx) (Routes and providers), [`finsight-frontend/src/api/index.ts`](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/api/index.ts) (API client functions), [`finsight-backend/src/routes/transaction.routes.ts`](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/routes/transaction.routes.ts) (API route modules), [`finsight-backend/src/utils/prisma.ts`](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/utils/prisma.ts) (Prisma client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Finance dashboard"]
  node_app["Routes and providers<br/>[App.tsx]"]
  node_auth_ui["Auth state<br/>[AuthContext.tsx]"]
  node_auth_pages["Sign in and register<br/>[LoginPage.tsx]"]
  node_profile["Profile settings"]
  node_transactions_ui["Transaction management"]
  node_transaction_form["Transaction editor"]
  node_budgets_ui["Budget management<br/>[BudgetsPage.tsx]"]
  node_budget_form["Budget editor<br/>[BudgetModal.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_analytics_ui["Analytics views<br/>[AnalyticsPage.tsx]"]
  node_charts["Charts"]
  node_api["API client functions<br/>[index.ts]"]
  node_http["HTTP and JWT client<br/>[client.ts]"]
end

subgraph group_backend["REST API"]
  node_api_server["Express application<br/>[index.ts]"]
  node_routes["API route modules"]
  node_auth_routes["Authentication routes<br/>[auth.routes.ts]"]
  node_validation["Request validation<br/>[validate.ts]"]
  node_response["Response helpers<br/>[response.ts]"]
end

subgraph group_security["Identity and access"]
  node_auth_middleware["JWT guard<br/>[auth.ts]"]
  node_auth_controller["Auth controller<br/>[auth.controller.ts]"]
  node_auth_service["Account and login<br/>[auth.service.ts]"]
  node_jwt["JWT signing<br/>[jwt.ts]"]
end

subgraph group_domain["Finance operations"]
  node_tx_controller["Transaction controller"]
  node_tx_service["Transaction operations"]
  node_budget_controller["Budget controller"]
  node_budget_service["Budget operations<br/>[budget.service.ts]"]
  node_analytics_controller["Analytics controller"]
  node_analytics_service["Analytics and insights"]
  node_category_controller["Category listing"]
end

subgraph group_persistence["Data persistence"]
  node_db_client["Prisma client<br/>[prisma.ts]"]
  node_database[("PostgreSQL data")]
end

node_user(("Finance user"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_auth_ui
node_app -->|"routes public"| node_auth_pages
node_app -->|"routes protected"| node_transactions_ui
node_app -->|"routes protected"| node_budgets_ui
node_app -->|"routes protected"| node_dashboard
node_app -->|"routes protected"| node_analytics_ui
node_app -->|"routes protected"| node_profile
node_auth_pages -->|"calls auth"| node_auth_ui
node_auth_ui -->|"calls auth API"| node_api
node_transactions_ui -->|"requests data"| node_api
node_transactions_ui -->|"opens editor"| node_transaction_form
node_budgets_ui -->|"requests data"| node_api
node_budgets_ui -->|"opens editor"| node_budget_form
node_dashboard -->|"requests summaries"| node_api
node_dashboard -->|"renders charts"| node_charts
node_analytics_ui -->|"requests analytics"| node_api
node_analytics_ui -->|"renders trends"| node_charts
node_profile -->|"requests account"| node_api
node_api -->|"sends requests"| node_http
node_http -.->|"calls REST API"| node_api_server
node_api_server -->|"mounts routers"| node_routes
node_api_server -->|"mounts router"| node_auth_routes
node_routes -->|"dispatches"| node_tx_controller
node_routes -->|"dispatches"| node_budget_controller
node_routes -->|"dispatches"| node_analytics_controller
node_routes -->|"dispatches"| node_category_controller
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"validates input"| node_validation
node_routes -->|"guards requests"| node_auth_middleware
node_auth_routes -->|"guards routes"| node_auth_middleware
node_tx_controller -->|"calls operations"| node_tx_service
node_budget_controller -->|"calls operations"| node_budget_service
node_analytics_controller -->|"calls analytics"| node_analytics_service
node_auth_controller -->|"calls account logic"| node_auth_service
node_auth_service -->|"signs tokens"| node_jwt
node_auth_middleware -->|"verifies tokens"| node_jwt
node_tx_service -->|"queries"| node_db_client
node_budget_service -->|"queries"| node_db_client
node_auth_service -->|"queries"| node_db_client
node_category_controller -->|"reads categories"| node_db_client
node_analytics_service -.->|"queries data"| node_db_client
node_db_client -.->|"reads and writes"| node_database
node_tx_controller -->|"formats responses"| node_response
node_auth_middleware -->|"returns errors"| node_response

click node_app "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/App.tsx"
click node_auth_ui "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/context/AuthContext.tsx"
click node_auth_pages "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/LoginPage.tsx"
click node_profile "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/ProfileSettingsPages.tsx"
click node_transactions_ui "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/TransactionsPage.tsx"
click node_transaction_form "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/components/forms/TransactionModal.tsx"
click node_budgets_ui "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/BudgetsPage.tsx"
click node_budget_form "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/components/forms/BudgetModal.tsx"
click node_dashboard "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/DashboardPage.tsx"
click node_analytics_ui "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/AnalyticsPage.tsx"
click node_charts "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/components/charts/OverviewBarChart.tsx"
click node_api "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/api/index.ts"
click node_http "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/api/client.ts"
click node_api_server "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/index.ts"
click node_routes "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/routes/transaction.routes.ts"
click node_auth_routes "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/routes/auth.routes.ts"
click node_auth_middleware "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/middleware/auth.ts"
click node_validation "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/middleware/validate.ts"
click node_auth_controller "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/auth.controller.ts"
click node_auth_service "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/services/auth.service.ts"
click node_jwt "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/utils/jwt.ts"
click node_tx_controller "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/transaction.controller.ts"
click node_tx_service "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/services/transaction.service.ts"
click node_budget_controller "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/budget.controller.ts"
click node_budget_service "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/services/budget.service.ts"
click node_analytics_controller "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/analytics.controller.ts"
click node_analytics_service "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/services/analytics.service.ts"
click node_category_controller "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/category.controller.ts"
click node_db_client "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/utils/prisma.ts"
click node_response "https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/utils/response.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_ui,node_auth_pages,node_profile,node_transactions_ui,node_transaction_form,node_budgets_ui,node_budget_form,node_dashboard,node_analytics_ui,node_charts,node_api,node_http,node_user toneBlue
class node_api_server,node_routes,node_auth_routes,node_validation,node_response toneAmber
class node_auth_middleware,node_auth_controller,node_auth_service,node_jwt toneMint
class node_tx_controller,node_tx_service,node_budget_controller,node_budget_service,node_analytics_controller,node_analytics_service,node_category_controller toneRose
class node_db_client,node_database toneIndigo
```

## Components

### Finance dashboard

- [Routes and providers](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/App.tsx): `finsight-frontend/src/App.tsx`
- [Auth state](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/context/AuthContext.tsx): `finsight-frontend/src/context/AuthContext.tsx`
- [Sign in and register](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/LoginPage.tsx): `finsight-frontend/src/pages/LoginPage.tsx`
- [Profile settings](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/ProfileSettingsPages.tsx): `finsight-frontend/src/pages/ProfileSettingsPages.tsx`
- [Transaction management](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/TransactionsPage.tsx): `finsight-frontend/src/pages/TransactionsPage.tsx`
- [Transaction editor](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/components/forms/TransactionModal.tsx): `finsight-frontend/src/components/forms/TransactionModal.tsx`
- [Budget management](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/BudgetsPage.tsx): `finsight-frontend/src/pages/BudgetsPage.tsx`
- [Budget editor](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/components/forms/BudgetModal.tsx): `finsight-frontend/src/components/forms/BudgetModal.tsx`
- [Dashboard](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/DashboardPage.tsx): `finsight-frontend/src/pages/DashboardPage.tsx`
- [Analytics views](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/pages/AnalyticsPage.tsx): `finsight-frontend/src/pages/AnalyticsPage.tsx`
- [Charts](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/components/charts/OverviewBarChart.tsx): `finsight-frontend/src/components/charts/OverviewBarChart.tsx`
- [API client functions](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/api/index.ts): `finsight-frontend/src/api/index.ts`
- [HTTP and JWT client](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-frontend/src/api/client.ts): `finsight-frontend/src/api/client.ts`

### REST API

- [Express application](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/index.ts): `finsight-backend/src/index.ts`
- [API route modules](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/routes/transaction.routes.ts): `finsight-backend/src/routes/transaction.routes.ts`
- [Authentication routes](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/routes/auth.routes.ts): `finsight-backend/src/routes/auth.routes.ts`
- [Request validation](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/middleware/validate.ts): `finsight-backend/src/middleware/validate.ts`
- [Response helpers](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/utils/response.ts): `finsight-backend/src/utils/response.ts`

### Identity and access

- [JWT guard](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/middleware/auth.ts): `finsight-backend/src/middleware/auth.ts`
- [Auth controller](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/auth.controller.ts): `finsight-backend/src/controllers/auth.controller.ts`
- [Account and login](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/services/auth.service.ts): `finsight-backend/src/services/auth.service.ts`
- [JWT signing](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/utils/jwt.ts): `finsight-backend/src/utils/jwt.ts`

### Finance operations

- [Transaction controller](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/transaction.controller.ts): `finsight-backend/src/controllers/transaction.controller.ts`
- [Transaction operations](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/services/transaction.service.ts): `finsight-backend/src/services/transaction.service.ts`
- [Budget controller](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/budget.controller.ts): `finsight-backend/src/controllers/budget.controller.ts`
- [Budget operations](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/services/budget.service.ts): `finsight-backend/src/services/budget.service.ts`
- [Analytics controller](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/analytics.controller.ts): `finsight-backend/src/controllers/analytics.controller.ts`
- [Analytics and insights](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/services/analytics.service.ts): `finsight-backend/src/services/analytics.service.ts`
- [Category listing](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/controllers/category.controller.ts): `finsight-backend/src/controllers/category.controller.ts`

### Data persistence

- [Prisma client](https://github.com/ab7-dev/expense-tracker-dashboard/blob/main/finsight-backend/src/utils/prisma.ts): `finsight-backend/src/utils/prisma.ts`
- **PostgreSQL data**

### Other components

- **Finance user**

## Connections

- Finance user → Routes and providers: uses (evidence: `finsight-frontend/src/App.tsx`)
- Routes and providers → Auth state: provides auth (evidence: `finsight-frontend/src/App.tsx`)
- Routes and providers → Sign in and register: routes public (evidence: `finsight-frontend/src/App.tsx`)
- Routes and providers → Transaction management: routes protected (evidence: `finsight-frontend/src/App.tsx`)
- Routes and providers → Budget management: routes protected (evidence: `finsight-frontend/src/App.tsx`)
- Routes and providers → Dashboard: routes protected (evidence: `finsight-frontend/src/App.tsx`)
- Routes and providers → Analytics views: routes protected (evidence: `finsight-frontend/src/App.tsx`)
- Routes and providers → Profile settings: routes protected (evidence: `finsight-frontend/src/App.tsx`)
- Sign in and register → Auth state: calls auth (evidence: `finsight-frontend/src/pages/LoginPage.tsx`)
- Auth state → API client functions: calls auth API (evidence: `finsight-frontend/src/context/AuthContext.tsx`)
- Transaction management → API client functions: requests data (evidence: `finsight-frontend/src/pages/TransactionsPage.tsx`)
- Transaction management → Transaction editor: opens editor (evidence: `finsight-frontend/src/pages/TransactionsPage.tsx`)
- Budget management → API client functions: requests data (evidence: `finsight-frontend/src/pages/BudgetsPage.tsx`)
- Budget management → Budget editor: opens editor (evidence: `finsight-frontend/src/pages/BudgetsPage.tsx`)
- Dashboard → API client functions: requests summaries (evidence: `finsight-frontend/src/pages/DashboardPage.tsx`)
- Dashboard → Charts: renders charts (evidence: `finsight-frontend/src/pages/DashboardPage.tsx`)
- Analytics views → API client functions: requests analytics (evidence: `finsight-frontend/src/pages/AnalyticsPage.tsx`)
- Analytics views → Charts: renders trends (evidence: `finsight-frontend/src/pages/AnalyticsPage.tsx`)
- Profile settings → API client functions: requests account (evidence: `finsight-frontend/src/pages/ProfileSettingsPages.tsx`)
- API client functions → HTTP and JWT client: sends requests (evidence: `finsight-frontend/src/api/index.ts`)
- HTTP and JWT client → Express application: calls REST API
- Express application → API route modules: mounts routers (evidence: `finsight-backend/src/index.ts`)
- Express application → Authentication routes: mounts router (evidence: `finsight-backend/src/index.ts`)
- API route modules → Transaction controller: dispatches (evidence: `finsight-backend/src/routes/transaction.routes.ts`)
- API route modules → Budget controller: dispatches
- API route modules → Analytics controller: dispatches
- API route modules → Category listing: dispatches
- Authentication routes → Auth controller: dispatches (evidence: `finsight-backend/src/routes/auth.routes.ts`)
- Authentication routes → Request validation: validates input (evidence: `finsight-backend/src/routes/auth.routes.ts`)
- API route modules → JWT guard: guards requests (evidence: `finsight-backend/src/routes/transaction.routes.ts`)
- Authentication routes → JWT guard: guards routes (evidence: `finsight-backend/src/routes/auth.routes.ts`)
- Transaction controller → Transaction operations: calls operations (evidence: `finsight-backend/src/controllers/transaction.controller.ts`)
- Budget controller → Budget operations: calls operations (evidence: `finsight-backend/src/controllers/budget.controller.ts`)
- Analytics controller → Analytics and insights: calls analytics
- Auth controller → Account and login: calls account logic (evidence: `finsight-backend/src/controllers/auth.controller.ts`)
- Account and login → JWT signing: signs tokens (evidence: `finsight-backend/src/services/auth.service.ts`)
- JWT guard → JWT signing: verifies tokens (evidence: `finsight-backend/src/middleware/auth.ts`)
- Transaction operations → Prisma client: queries (evidence: `finsight-backend/src/services/transaction.service.ts`)
- Budget operations → Prisma client: queries (evidence: `finsight-backend/src/services/budget.service.ts`)
- Account and login → Prisma client: queries (evidence: `finsight-backend/src/services/auth.service.ts`)
- Category listing → Prisma client: reads categories (evidence: `finsight-backend/src/controllers/category.controller.ts`)
- Analytics and insights → Prisma client: queries data
- Prisma client → PostgreSQL data: reads and writes
- Transaction controller → Response helpers: formats responses (evidence: `finsight-backend/src/controllers/transaction.controller.ts`)
- JWT guard → Response helpers: returns errors (evidence: `finsight-backend/src/middleware/auth.ts`)
