# atharvaagarwal-01/budget-planner architecture

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

- Interactive diagram: https://gitdiagram.com/atharvaagarwal-01/budget-planner
- Repository: https://github.com/atharvaagarwal-01/budget-planner

## Overview

FinTrack is a personal-finance web app: users authenticate, record income and expenses, then review balances, budgets, and analytics; settings provide base-currency and category management. TanStack route pages call API endpoints, which handle user-scoped data through the Netlify Blobs access layer. The README documents the major product capabilities, while sampled source confirms several page/API interactions and the storage implementation. Dashboard and analytics internals, and most API handler bodies, were not sampled, so some connections are shown as unverified rather than asserted.

Main entry points: [`src/lib/db.ts`](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/lib/db.ts) (Finance Data Access), [`src/routes/transactions.tsx`](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/transactions.tsx) (Transaction Logging), [`src/routes/budget.tsx`](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/budget.tsx) (Budget Planner), [`src/lib/auth.ts`](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/lib/auth.ts) (Server Auth)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and Navigation"]
  node_login["Login and Signup<br/>[login.tsx]"]
  node_identity_context["Identity Context"]
  node_auth["Server Auth<br/>[auth.ts]"]
  node_middleware["Identity Middleware<br/>[identity.ts]"]
  node_callback["Auth Callback"]
  node_signup["Signup Role Hook<br/>[identity-signup.ts]"]
  node_sidebar["Navigation Sidebar<br/>[Sidebar.tsx]"]
  node_home["Entry Redirect<br/>[index.tsx]"]
end

subgraph group_finance["Finance Workflows"]
  node_dashboard["Dashboard<br/>[dashboard.tsx]"]
  node_transactions["Transaction Logging<br/>[transactions.tsx]"]
  node_budget["Budget Planner<br/>[budget.tsx]"]
  node_analytics["Financial Analytics<br/>[analytics.tsx]"]
  node_settings["Settings and Categories<br/>[settings.tsx]"]
end

subgraph group_api["Application API"]
  node_tx_api["Transaction API<br/>[transactions.ts]"]
  node_tx_item_api["Transaction Item API"]
  node_budget_api["Budget API<br/>[budgets.ts]"]
  node_budget_item_api["Budget Item API<br/>[budgets.$id.ts]"]
  node_category_api["Category API<br/>[categories.ts]"]
  node_settings_api["User Settings API<br/>[user-settings.ts]"]
  node_rates_api["Exchange Rate API<br/>[exchange-rates.ts]"]
end

subgraph group_persistence["Persistence and Integrations"]
  node_data_access["Finance Data Access<br/>[db.ts]"]
  node_blobs[("Netlify Blobs")]
  node_identity_service["Netlify Identity"]
  node_rates_service["Exchange Rate Service"]
end

node_user(("User"))

node_user -->|"signs in"| node_login
node_login -.->|"authenticates"| node_identity_context
node_callback -->|"handles callback"| node_identity_service
node_identity_context -->|"reads auth state"| node_identity_service
node_sidebar -->|"reads user state"| node_identity_context
node_sidebar -->|"signs out"| node_user
node_home -->|"checks user"| node_auth
node_auth -->|"gets user"| node_identity_service
node_user -->|"views overview"| node_dashboard
node_user -->|"logs transactions"| node_transactions
node_user -->|"plans spending"| node_budget
node_user -->|"reviews trends"| node_analytics
node_user -->|"manages preferences"| node_settings
node_transactions -->|"checks user"| node_auth
node_budget -->|"checks user"| node_auth
node_settings -->|"checks user"| node_auth
node_transactions -->|"fetches data"| node_tx_api
node_transactions -.->|"fetches categories"| node_category_api
node_transactions -->|"fetches preferences"| node_settings_api
node_transactions -->|"loads rates"| node_rates_api
node_budget -->|"saves budgets"| node_budget_api
node_budget -.->|"loads spending"| node_tx_api
node_budget -.->|"loads categories"| node_category_api
node_budget -->|"loads preferences"| node_settings_api
node_settings -->|"manages categories"| node_category_api
node_settings -->|"loads preferences"| node_settings_api
node_tx_api -->|"accesses records"| node_data_access
node_tx_item_api -->|"accesses records"| node_data_access
node_budget_api -->|"accesses budgets"| node_data_access
node_budget_item_api -->|"accesses budgets"| node_data_access
node_category_api -->|"reads and saves"| node_data_access
node_settings_api -->|"accesses settings"| node_data_access
node_rates_api -->|"uses rate cache"| node_data_access
node_rates_api -.->|"fetches rates"| node_rates_service
node_data_access -->|"reads and writes"| node_blobs
node_signup -.->|"assigns role"| node_identity_service

click node_login "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/login.tsx"
click node_identity_context "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/lib/identity-context.tsx"
click node_auth "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/lib/auth.ts"
click node_middleware "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/middleware/identity.ts"
click node_callback "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/components/CallbackHandler.tsx"
click node_signup "https://github.com/atharvaagarwal-01/budget-planner/blob/main/netlify/functions/identity-signup.ts"
click node_sidebar "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/components/Sidebar.tsx"
click node_home "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/index.tsx"
click node_dashboard "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/dashboard.tsx"
click node_transactions "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/transactions.tsx"
click node_budget "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/budget.tsx"
click node_analytics "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/analytics.tsx"
click node_settings "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/settings.tsx"
click node_tx_api "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/transactions.ts"
click node_tx_item_api "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/transactions.%24id.ts"
click node_budget_api "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/budgets.ts"
click node_budget_item_api "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/budgets.%24id.ts"
click node_category_api "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/categories.ts"
click node_settings_api "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/user-settings.ts"
click node_rates_api "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/exchange-rates.ts"
click node_data_access "https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/lib/db.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_login,node_identity_context,node_auth,node_middleware,node_callback,node_signup,node_sidebar,node_home,node_user toneBlue
class node_dashboard,node_transactions,node_budget,node_analytics,node_settings toneAmber
class node_tx_api,node_tx_item_api,node_budget_api,node_budget_item_api,node_category_api,node_settings_api,node_rates_api toneMint
class node_data_access,node_blobs,node_identity_service,node_rates_service toneRose
```

## Components

### Identity and Navigation

- [Login and Signup](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/login.tsx): `src/routes/login.tsx`
- [Identity Context](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/lib/identity-context.tsx): `src/lib/identity-context.tsx`
- [Server Auth](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Identity Middleware](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/middleware/identity.ts): `src/middleware/identity.ts`
- [Auth Callback](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/components/CallbackHandler.tsx): `src/components/CallbackHandler.tsx`
- [Signup Role Hook](https://github.com/atharvaagarwal-01/budget-planner/blob/main/netlify/functions/identity-signup.ts): `netlify/functions/identity-signup.ts`
- [Navigation Sidebar](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Entry Redirect](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/index.tsx): `src/routes/index.tsx`

### Finance Workflows

- [Dashboard](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/dashboard.tsx): `src/routes/dashboard.tsx`
- [Transaction Logging](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/transactions.tsx): `src/routes/transactions.tsx`
- [Budget Planner](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/budget.tsx): `src/routes/budget.tsx`
- [Financial Analytics](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/analytics.tsx): `src/routes/analytics.tsx`
- [Settings and Categories](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/settings.tsx): `src/routes/settings.tsx`

### Application API

- [Transaction API](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/transactions.ts): `src/routes/api/transactions.ts`
- [Transaction Item API](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/transactions.%24id.ts): `src/routes/api/transactions.$id.ts`
- [Budget API](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/budgets.ts): `src/routes/api/budgets.ts`
- [Budget Item API](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/budgets.%24id.ts): `src/routes/api/budgets.$id.ts`
- [Category API](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/categories.ts): `src/routes/api/categories.ts`
- [User Settings API](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/user-settings.ts): `src/routes/api/user-settings.ts`
- [Exchange Rate API](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/routes/api/exchange-rates.ts): `src/routes/api/exchange-rates.ts`

### Persistence and Integrations

- [Finance Data Access](https://github.com/atharvaagarwal-01/budget-planner/blob/main/src/lib/db.ts): `src/lib/db.ts`
- **Netlify Blobs**
- **Netlify Identity**
- **Exchange Rate Service**

### Other components

- **User**

## Connections

- User → Login and Signup: signs in (evidence: `README.md`)
- Login and Signup → Identity Context: authenticates (evidence: `src/routes/login.tsx`)
- Auth Callback → Netlify Identity: handles callback (evidence: `src/components/CallbackHandler.tsx`)
- Identity Context → Netlify Identity: reads auth state (evidence: `src/lib/identity-context.tsx`)
- Navigation Sidebar → Identity Context: reads user state (evidence: `src/components/Sidebar.tsx`)
- Navigation Sidebar → User: signs out (evidence: `src/components/Sidebar.tsx`)
- Entry Redirect → Server Auth: checks user (evidence: `src/routes/index.tsx`)
- Server Auth → Netlify Identity: gets user (evidence: `src/lib/auth.ts`)
- User → Dashboard: views overview (evidence: `README.md`)
- User → Transaction Logging: logs transactions (evidence: `README.md`)
- User → Budget Planner: plans spending (evidence: `README.md`)
- User → Financial Analytics: reviews trends (evidence: `README.md`)
- User → Settings and Categories: manages preferences (evidence: `README.md`)
- Transaction Logging → Server Auth: checks user (evidence: `src/routes/transactions.tsx`)
- Budget Planner → Server Auth: checks user (evidence: `src/routes/budget.tsx`)
- Settings and Categories → Server Auth: checks user (evidence: `src/routes/settings.tsx`)
- Transaction Logging → Transaction API: fetches data (evidence: `src/routes/transactions.tsx`)
- Transaction Logging → Category API: fetches categories
- Transaction Logging → User Settings API: fetches preferences (evidence: `src/routes/transactions.tsx`)
- Transaction Logging → Exchange Rate API: loads rates (evidence: `src/routes/transactions.tsx`)
- Budget Planner → Budget API: saves budgets (evidence: `src/routes/budget.tsx`)
- Budget Planner → Transaction API: loads spending
- Budget Planner → Category API: loads categories
- Budget Planner → User Settings API: loads preferences (evidence: `src/routes/budget.tsx`)
- Settings and Categories → Category API: manages categories (evidence: `src/routes/settings.tsx`)
- Settings and Categories → User Settings API: loads preferences (evidence: `src/routes/settings.tsx`)
- Transaction API → Finance Data Access: accesses records (evidence: `src/routes/api/transactions.ts`)
- Transaction Item API → Finance Data Access: accesses records (evidence: `src/routes/api/transactions.$id.ts`)
- Budget API → Finance Data Access: accesses budgets (evidence: `src/routes/api/budgets.ts`)
- Budget Item API → Finance Data Access: accesses budgets (evidence: `src/routes/api/budgets.$id.ts`)
- Category API → Finance Data Access: reads and saves (evidence: `src/routes/api/categories.ts`)
- User Settings API → Finance Data Access: accesses settings (evidence: `src/routes/api/user-settings.ts`)
- Exchange Rate API → Finance Data Access: uses rate cache (evidence: `src/routes/api/exchange-rates.ts`)
- Exchange Rate API → Exchange Rate Service: fetches rates
- Finance Data Access → Netlify Blobs: reads and writes (evidence: `src/lib/db.ts`)
- Signup Role Hook → Netlify Identity: assigns role
