# shubham144/expensetracker architecture

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

- Interactive diagram: https://gitdiagram.com/shubham144/expensetracker
- Repository: https://github.com/shubham144/expensetracker

## Overview

ExpenseTracker is a family-oriented personal finance application. Users authenticate into a family workspace, manage accounts and access, record expenses and income, and work with budgets, loans, settlements, and analytics. The frontend routes users to these capabilities and its API client modules call the backend endpoints; backend services apply business rules and persist financial records through the shared EF Core context. Edges are limited to calls or registrations visible in excerpts or the source index; unsampled feature wiring is represented cautiously.

Main entry points: [`backend/ExpenseTracker.Infrastructure/Data/ExpenseTrackerDbContext.cs`](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Data/ExpenseTrackerDbContext.cs) (Finance database context), [`backend/ExpenseTracker.Api/Program.cs`](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Api/Program.cs) (API registration), [`backend/ExpenseTracker.Infrastructure/Authentication/AuthService.cs`](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Authentication/AuthService.cs) (Authentication), [`backend/ExpenseTracker.Infrastructure/Accounts/AccountAuthorizationService.cs`](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Accounts/AccountAuthorizationService.cs) (Account authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_web["App routes<br/>[App.tsx]"]
  node_authui["Auth context<br/>[AuthContext.tsx]"]
  node_pages["Finance pages"]
  node_webapi["API client<br/>[client.ts]"]
end

subgraph group_api["HTTP API"]
  node_authend["Auth endpoints<br/>[AuthEndpoints.cs]"]
  node_endpoints["Finance endpoints<br/>[Endpoints]"]
  node_startup["API registration<br/>[Program.cs]"]
end

subgraph group_services["Finance services"]
  node_accounts["Accounts and access<br/>[Accounts]"]
  node_expenses["Expense tracking<br/>[ExpenseService.cs]"]
  node_income["Income tracking<br/>[IncomeService.cs]"]
  node_budgets["Budgets<br/>[BudgetService.cs]"]
  node_categories["Categories<br/>[CategoryService.cs]"]
  node_families["Families<br/>[FamilyService.cs]"]
  node_loans["Loans and payments<br/>[LoanService.cs]"]
  node_settlements["Settlements"]
  node_analytics["Analytics"]
end

subgraph group_identity["Identity and access"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_tokens["JWT generation"]
  node_identityuser["Identity user"]
  node_authorization["Account authorization"]
end

subgraph group_persistence["Persistence"]
  node_db[("Finance database context")]
end

node_user(("Family user"))

node_user -->|"uses"| node_web
node_web -->|"provides auth"| node_authui
node_web -->|"routes to"| node_pages
node_pages -.->|"requests data"| node_webapi
node_webapi -.->|"HTTP requests"| node_endpoints
node_startup -.->|"maps routes"| node_endpoints
node_startup -->|"registers service"| node_auth
node_startup -->|"registers service"| node_tokens
node_startup -->|"registers service"| node_families
node_startup -->|"registers service"| node_categories
node_startup -->|"registers service"| node_expenses
node_startup -->|"registers service"| node_accounts
node_authend -->|"calls"| node_auth
node_auth -->|"generates token"| node_tokens
node_auth -->|"reads and writes"| node_db
node_auth -->|"uses identity"| node_identityuser
node_expenses -->|"checks access"| node_authorization
node_income -->|"checks access"| node_authorization
node_loans -->|"checks access"| node_authorization
node_settlements -->|"checks access"| node_authorization
node_authorization -->|"queries memberships"| node_db
node_expenses -->|"reads and writes"| node_db
node_income -->|"reads and writes"| node_db
node_loans -->|"reads and writes"| node_db
node_settlements -->|"reads and writes"| node_db
node_budgets -->|"reads and writes"| node_db
node_accounts -.->|"reads and writes"| node_db
node_categories -.->|"reads and writes"| node_db
node_families -.->|"reads and writes"| node_db
node_analytics -.->|"queries data"| node_db
node_loans -->|"updates balances"| node_db
node_settlements -->|"updates balances"| node_db

click node_web "https://github.com/shubham144/expensetracker/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/shubham144/expensetracker/blob/main/frontend/src/components/AuthContext.tsx"
click node_pages "https://github.com/shubham144/expensetracker/tree/main/frontend/src/pages"
click node_webapi "https://github.com/shubham144/expensetracker/blob/main/frontend/src/api/client.ts"
click node_authend "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Api/Endpoints/AuthEndpoints.cs"
click node_endpoints "https://github.com/shubham144/expensetracker/tree/main/backend/ExpenseTracker.Api/Endpoints"
click node_startup "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Api/Program.cs"
click node_accounts "https://github.com/shubham144/expensetracker/tree/main/backend/ExpenseTracker.Infrastructure/Accounts"
click node_expenses "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Expenses/ExpenseService.cs"
click node_income "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Income/IncomeService.cs"
click node_budgets "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Budgets/BudgetService.cs"
click node_categories "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Categories/CategoryService.cs"
click node_families "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Families/FamilyService.cs"
click node_loans "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Loans/LoanService.cs"
click node_settlements "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Settlements/SettlementService.cs"
click node_analytics "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Analytics/AnalyticsService.cs"
click node_auth "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Authentication/AuthService.cs"
click node_tokens "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Authentication/JwtTokenGenerator.cs"
click node_identityuser "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Authentication/ApplicationIdentityUser.cs"
click node_authorization "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Accounts/AccountAuthorizationService.cs"
click node_db "https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Data/ExpenseTrackerDbContext.cs"

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_web,node_authui,node_pages,node_webapi,node_user toneBlue
class node_authend,node_endpoints,node_startup toneAmber
class node_accounts,node_expenses,node_income,node_budgets,node_categories,node_families,node_loans,node_settlements,node_analytics toneMint
class node_auth,node_tokens,node_identityuser,node_authorization toneRose
class node_db toneIndigo
```

## Components

### Web application

- [App routes](https://github.com/shubham144/expensetracker/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Auth context](https://github.com/shubham144/expensetracker/blob/main/frontend/src/components/AuthContext.tsx): `frontend/src/components/AuthContext.tsx`
- [Finance pages](https://github.com/shubham144/expensetracker/tree/main/frontend/src/pages): `frontend/src/pages`
- [API client](https://github.com/shubham144/expensetracker/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### HTTP API

- [Auth endpoints](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Api/Endpoints/AuthEndpoints.cs): `backend/ExpenseTracker.Api/Endpoints/AuthEndpoints.cs`
- [Finance endpoints](https://github.com/shubham144/expensetracker/tree/main/backend/ExpenseTracker.Api/Endpoints): `backend/ExpenseTracker.Api/Endpoints`
- [API registration](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Api/Program.cs): `backend/ExpenseTracker.Api/Program.cs`

### Finance services

- [Accounts and access](https://github.com/shubham144/expensetracker/tree/main/backend/ExpenseTracker.Infrastructure/Accounts): `backend/ExpenseTracker.Infrastructure/Accounts`
- [Expense tracking](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Expenses/ExpenseService.cs): `backend/ExpenseTracker.Infrastructure/Expenses/ExpenseService.cs`
- [Income tracking](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Income/IncomeService.cs): `backend/ExpenseTracker.Infrastructure/Income/IncomeService.cs`
- [Budgets](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Budgets/BudgetService.cs): `backend/ExpenseTracker.Infrastructure/Budgets/BudgetService.cs`
- [Categories](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Categories/CategoryService.cs): `backend/ExpenseTracker.Infrastructure/Categories/CategoryService.cs`
- [Families](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Families/FamilyService.cs): `backend/ExpenseTracker.Infrastructure/Families/FamilyService.cs`
- [Loans and payments](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Loans/LoanService.cs): `backend/ExpenseTracker.Infrastructure/Loans/LoanService.cs`
- [Settlements](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Settlements/SettlementService.cs): `backend/ExpenseTracker.Infrastructure/Settlements/SettlementService.cs`
- [Analytics](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Analytics/AnalyticsService.cs): `backend/ExpenseTracker.Infrastructure/Analytics/AnalyticsService.cs`

### Identity and access

- [Authentication](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Authentication/AuthService.cs): `backend/ExpenseTracker.Infrastructure/Authentication/AuthService.cs`
- [JWT generation](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Authentication/JwtTokenGenerator.cs): `backend/ExpenseTracker.Infrastructure/Authentication/JwtTokenGenerator.cs`
- [Identity user](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Authentication/ApplicationIdentityUser.cs): `backend/ExpenseTracker.Infrastructure/Authentication/ApplicationIdentityUser.cs`
- [Account authorization](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Accounts/AccountAuthorizationService.cs): `backend/ExpenseTracker.Infrastructure/Accounts/AccountAuthorizationService.cs`

### Persistence

- [Finance database context](https://github.com/shubham144/expensetracker/blob/main/backend/ExpenseTracker.Infrastructure/Data/ExpenseTrackerDbContext.cs): `backend/ExpenseTracker.Infrastructure/Data/ExpenseTrackerDbContext.cs`

### Other components

- **Family user**

## Connections

- Family user → App routes: uses (evidence: `frontend/src/App.tsx`)
- App routes → Auth context: provides auth (evidence: `frontend/src/App.tsx`)
- App routes → Finance pages: routes to (evidence: `frontend/src/App.tsx`)
- Finance pages → API client: requests data
- API client → Finance endpoints: HTTP requests
- API registration → Finance endpoints: maps routes
- API registration → Authentication: registers service (evidence: `backend/ExpenseTracker.Api/Program.cs`)
- API registration → JWT generation: registers service (evidence: `backend/ExpenseTracker.Api/Program.cs`)
- API registration → Families: registers service (evidence: `backend/ExpenseTracker.Api/Program.cs`)
- API registration → Categories: registers service (evidence: `backend/ExpenseTracker.Api/Program.cs`)
- API registration → Expense tracking: registers service (evidence: `backend/ExpenseTracker.Api/Program.cs`)
- API registration → Accounts and access: registers service (evidence: `backend/ExpenseTracker.Api/Program.cs`)
- Auth endpoints → Authentication: calls (evidence: `backend/ExpenseTracker.Api/Endpoints/AuthEndpoints.cs`)
- Authentication → JWT generation: generates token (evidence: `backend/ExpenseTracker.Infrastructure/Authentication/AuthService.cs`)
- Authentication → Finance database context: reads and writes (evidence: `backend/ExpenseTracker.Infrastructure/Authentication/AuthService.cs`)
- Authentication → Identity user: uses identity (evidence: `backend/ExpenseTracker.Infrastructure/Authentication/AuthService.cs`)
- Expense tracking → Account authorization: checks access (evidence: `backend/ExpenseTracker.Infrastructure/Expenses/ExpenseService.cs`)
- Income tracking → Account authorization: checks access (evidence: `backend/ExpenseTracker.Infrastructure/Income/IncomeService.cs`)
- Loans and payments → Account authorization: checks access (evidence: `backend/ExpenseTracker.Infrastructure/Loans/LoanService.cs`)
- Settlements → Account authorization: checks access (evidence: `backend/ExpenseTracker.Infrastructure/Settlements/SettlementService.cs`)
- Account authorization → Finance database context: queries memberships (evidence: `backend/ExpenseTracker.Infrastructure/Accounts/AccountAuthorizationService.cs`)
- Expense tracking → Finance database context: reads and writes (evidence: `backend/ExpenseTracker.Infrastructure/Expenses/ExpenseService.cs`)
- Income tracking → Finance database context: reads and writes (evidence: `backend/ExpenseTracker.Infrastructure/Income/IncomeService.cs`)
- Loans and payments → Finance database context: reads and writes (evidence: `backend/ExpenseTracker.Infrastructure/Loans/LoanService.cs`)
- Settlements → Finance database context: reads and writes (evidence: `backend/ExpenseTracker.Infrastructure/Settlements/SettlementService.cs`)
- Budgets → Finance database context: reads and writes (evidence: `backend/ExpenseTracker.Infrastructure/Budgets/BudgetService.cs`)
- Accounts and access → Finance database context: reads and writes (evidence: `backend/ExpenseTracker.Infrastructure/Accounts/AccountAuthorizationService.cs`)
- Categories → Finance database context: reads and writes (evidence: `backend/ExpenseTracker.Infrastructure/Categories/CategoryService.cs`)
- Families → Finance database context: reads and writes
- Analytics → Finance database context: queries data
- Loans and payments → Finance database context: updates balances (evidence: `backend/ExpenseTracker.Infrastructure/Loans/LoanService.cs`)
- Settlements → Finance database context: updates balances (evidence: `backend/ExpenseTracker.Infrastructure/Settlements/SettlementService.cs`)
