# aryan22n/nova-expense-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/aryan22n/nova-expense-tracker
- Repository: https://github.com/aryan22n/nova-expense-tracker

## Overview

Smart Expense Tracker is a Next.js personal-finance application. The main workflow is adding an expense, categorizing it, storing it, and reviewing spending through the dashboard, transaction history, and analytics. It also provides budgets, shared expense splits, electricity and mess bill tracking, and account access. The graph includes these distinct product areas and the database/auth layers. Some page-to-API connections are not visible in the excerpts or explicit documentation, so they are left unconnected rather than inferred.

Main entry points: [`lib/db/index.ts`](https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/db/index.ts) (Neon Postgres), [`app/api/transactions/route.ts`](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/transactions/route.ts) (Transactions API), [`app/api/transactions/[id]/route.ts`](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/transactions/%5Bid%5D/route.ts) (Transaction item API), [`components/expense-dashboard.tsx`](https://github.com/aryan22n/nova-expense-tracker/blob/main/components/expense-dashboard.tsx) (Expense dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_analytics["Analytics<br/>[page.tsx]"]
  node_history["Transaction history<br/>[page.tsx]"]
  node_splits_ui["Splits dashboard"]
end

subgraph group_transactions["Expense tracking"]
  node_expense_ui["Expense dashboard"]
  node_expense_form["Add expense form"]
  node_transactions_api["Transactions API<br/>[route.ts]"]
  node_transaction_item_api["Transaction item API<br/>[route.ts]"]
  node_categorization["Auto-categorization<br/>[categorize.ts]"]
  node_summary_api["Spending summary API<br/>[route.ts]"]
  node_categories_api["Categories API<br/>[route.ts]"]
  node_settings_api["Budget settings API<br/>[route.ts]"]
end

subgraph group_shared["Shared bills and splits"]
  node_electricity_ui["Electricity bills<br/>[page.tsx]"]
  node_electricity_share["Shared bill view<br/>[page.tsx]"]
  node_mess_ui["Mess bills<br/>[page.tsx]"]
  node_split_api["Splits API<br/>[route.ts]"]
  node_split_settle["Split settlement<br/>[route.ts]"]
  node_friends_api["Friends API<br/>[route.ts]"]
  node_electricity_actions["Electricity actions"]
  node_mess_actions["Mess actions<br/>[mess-actions.ts]"]
end

subgraph group_platform["Auth and persistence"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_auth_client["Auth client<br/>[auth-client.ts]"]
  node_api_helpers["API session helpers<br/>[api-helpers.ts]"]
  node_database[("Neon Postgres<br/>[index.ts]")]
  node_schema["Finance data schema<br/>[schema.ts]"]
end

node_user(("User"))

node_user -->|"opens"| node_dashboard
node_dashboard -->|"renders"| node_expense_ui
node_expense_ui -->|"renders"| node_expense_form
node_user -.->|"adds expenses"| node_expense_ui
node_transactions_api -->|"categorizes"| node_categorization
node_transaction_item_api -->|"categorizes"| node_categorization
node_transactions_api -->|"reads and writes"| node_database
node_transaction_item_api -->|"reads and writes"| node_database
node_categorization -->|"loads rules"| node_database
node_analytics -.->|"requests summary"| node_summary_api
node_history -.->|"requests records"| node_transactions_api
node_history -.->|"edits records"| node_transaction_item_api
node_summary_api -->|"queries spending"| node_database
node_categories_api -->|"reads categories"| node_database
node_settings_api -->|"reads and writes"| node_database
node_split_api -->|"reads and writes"| node_database
node_split_settle -->|"updates settlements"| node_database
node_friends_api -->|"reads and writes"| node_database
node_electricity_ui -->|"loads bills"| node_electricity_actions
node_electricity_actions -->|"reads and writes"| node_database
node_electricity_share -->|"uses bill actions"| node_electricity_actions
node_mess_ui -->|"uses bill actions"| node_mess_actions
node_auth_client -.->|"configures client"| node_auth
node_api_helpers -->|"gets session"| node_auth
node_transactions_api -->|"checks session"| node_api_helpers
node_database -->|"uses schema"| node_schema

click node_dashboard "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/dashboard/page.tsx"
click node_analytics "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/analytics/page.tsx"
click node_history "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/transactions/page.tsx"
click node_splits_ui "https://github.com/aryan22n/nova-expense-tracker/blob/main/components/splits-dashboard.tsx"
click node_electricity_ui "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/electricity/page.tsx"
click node_electricity_share "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/electricity/share/%5Btoken%5D/page.tsx"
click node_mess_ui "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/mess/page.tsx"
click node_split_api "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/splits/route.ts"
click node_split_settle "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/splits/settle/route.ts"
click node_friends_api "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/friends/route.ts"
click node_electricity_actions "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/actions/electricity-actions.ts"
click node_mess_actions "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/actions/mess-actions.ts"
click node_expense_ui "https://github.com/aryan22n/nova-expense-tracker/blob/main/components/expense-dashboard.tsx"
click node_expense_form "https://github.com/aryan22n/nova-expense-tracker/blob/main/components/add-expense-form.tsx"
click node_transactions_api "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/transactions/route.ts"
click node_transaction_item_api "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/transactions/%5Bid%5D/route.ts"
click node_categorization "https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/categorize.ts"
click node_summary_api "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/summary/route.ts"
click node_categories_api "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/categories/route.ts"
click node_settings_api "https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/settings/route.ts"
click node_auth "https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/auth.ts"
click node_auth_client "https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/auth-client.ts"
click node_api_helpers "https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/api-helpers.ts"
click node_database "https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/db/index.ts"
click node_schema "https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/db/schema.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_dashboard,node_analytics,node_history,node_splits_ui,node_user toneBlue
class node_expense_ui,node_expense_form,node_transactions_api,node_transaction_item_api,node_categorization,node_summary_api,node_categories_api,node_settings_api toneAmber
class node_electricity_ui,node_electricity_share,node_mess_ui,node_split_api,node_split_settle,node_friends_api,node_electricity_actions,node_mess_actions toneMint
class node_auth,node_auth_client,node_api_helpers,node_database,node_schema toneRose
```

## Components

### User experience

- [Dashboard](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Analytics](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/analytics/page.tsx): `app/analytics/page.tsx`
- [Transaction history](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/transactions/page.tsx): `app/transactions/page.tsx`
- [Splits dashboard](https://github.com/aryan22n/nova-expense-tracker/blob/main/components/splits-dashboard.tsx): `components/splits-dashboard.tsx`

### Expense tracking

- [Expense dashboard](https://github.com/aryan22n/nova-expense-tracker/blob/main/components/expense-dashboard.tsx): `components/expense-dashboard.tsx`
- [Add expense form](https://github.com/aryan22n/nova-expense-tracker/blob/main/components/add-expense-form.tsx): `components/add-expense-form.tsx`
- [Transactions API](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/transactions/route.ts): `app/api/transactions/route.ts`
- [Transaction item API](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/transactions/%5Bid%5D/route.ts): `app/api/transactions/[id]/route.ts`
- [Auto-categorization](https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/categorize.ts): `lib/categorize.ts`
- [Spending summary API](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/summary/route.ts): `app/api/summary/route.ts`
- [Categories API](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/categories/route.ts): `app/api/categories/route.ts`
- [Budget settings API](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/settings/route.ts): `app/api/settings/route.ts`

### Shared bills and splits

- [Electricity bills](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/electricity/page.tsx): `app/electricity/page.tsx`
- [Shared bill view](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/electricity/share/%5Btoken%5D/page.tsx): `app/electricity/share/[token]/page.tsx`
- [Mess bills](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/mess/page.tsx): `app/mess/page.tsx`
- [Splits API](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/splits/route.ts): `app/api/splits/route.ts`
- [Split settlement](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/splits/settle/route.ts): `app/api/splits/settle/route.ts`
- [Friends API](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/api/friends/route.ts): `app/api/friends/route.ts`
- [Electricity actions](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/actions/electricity-actions.ts): `app/actions/electricity-actions.ts`
- [Mess actions](https://github.com/aryan22n/nova-expense-tracker/blob/main/app/actions/mess-actions.ts): `app/actions/mess-actions.ts`

### Auth and persistence

- [Authentication](https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/auth.ts): `lib/auth.ts`
- [Auth client](https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/auth-client.ts): `lib/auth-client.ts`
- [API session helpers](https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/api-helpers.ts): `lib/api-helpers.ts`
- [Neon Postgres](https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/db/index.ts): `lib/db/index.ts`
- [Finance data schema](https://github.com/aryan22n/nova-expense-tracker/blob/main/lib/db/schema.ts): `lib/db/schema.ts`

### Other components

- **User**

## Connections

- User → Dashboard: opens (evidence: `app/dashboard/page.tsx`)
- Dashboard → Expense dashboard: renders (evidence: `app/dashboard/page.tsx`)
- Expense dashboard → Add expense form: renders (evidence: `components/expense-dashboard.tsx`)
- User → Expense dashboard: adds expenses
- Transactions API → Auto-categorization: categorizes (evidence: `app/api/transactions/route.ts`)
- Transaction item API → Auto-categorization: categorizes (evidence: `app/api/transactions/[id]/route.ts`)
- Transactions API → Neon Postgres: reads and writes (evidence: `app/api/transactions/route.ts`)
- Transaction item API → Neon Postgres: reads and writes (evidence: `app/api/transactions/[id]/route.ts`)
- Auto-categorization → Neon Postgres: loads rules (evidence: `lib/categorize.ts`)
- Analytics → Spending summary API: requests summary
- Transaction history → Transactions API: requests records
- Transaction history → Transaction item API: edits records
- Spending summary API → Neon Postgres: queries spending (evidence: `app/api/summary/route.ts`)
- Categories API → Neon Postgres: reads categories (evidence: `app/api/categories/route.ts`)
- Budget settings API → Neon Postgres: reads and writes (evidence: `app/api/settings/route.ts`)
- Splits API → Neon Postgres: reads and writes (evidence: `app/api/splits/route.ts`)
- Split settlement → Neon Postgres: updates settlements (evidence: `app/api/splits/settle/route.ts`)
- Friends API → Neon Postgres: reads and writes (evidence: `app/api/friends/route.ts`)
- Electricity bills → Electricity actions: loads bills (evidence: `app/electricity/page.tsx`)
- Electricity actions → Neon Postgres: reads and writes (evidence: `app/actions/electricity-actions.ts`)
- Shared bill view → Electricity actions: uses bill actions (evidence: `app/electricity/share/[token]/page.tsx`)
- Mess bills → Mess actions: uses bill actions (evidence: `app/mess/page.tsx`)
- Auth client → Authentication: configures client
- API session helpers → Authentication: gets session (evidence: `lib/api-helpers.ts`)
- Transactions API → API session helpers: checks session (evidence: `app/api/transactions/route.ts`)
- Neon Postgres → Finance data schema: uses schema (evidence: `lib/db/index.ts`)
