# dilshodimomov/finance-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/dilshodimomov/finance-tracker
- Repository: https://github.com/dilshodimomov/finance-tracker

## Overview

Finance Tracker ingests DIB purchase notifications, stores and categorizes transactions, then lets authorized users inspect and correct spending in a dashboard. Its documented workflow includes Gmail and Apps Script, an ingest API, Postgres, merchant rules, and dashboard reporting and editing. Authentication combines Supabase sessions with app-level authorization. The repository also contains an optional Remotion showcase video. Web relationships below rely chiefly on README descriptions; unsampled internals are represented at subsystem level rather than inferred call-by-call.

Main entry points: [`apps/remotion/src/compositions/DIBFinanceAd.tsx`](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/DIBFinanceAd.tsx) (Finance showcase composition), [`apps/remotion/src/components/Background.tsx`](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/components/Background.tsx) (Animated background), [`apps/remotion/src/components/GlassCard.tsx`](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/components/GlassCard.tsx) (Glass card), [`apps/web/src/app/dashboard/page.tsx`](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/app/dashboard/page.tsx) (Finance dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingest and categorization"]
  node_ingest_api["DIB ingest API<br/>[route.ts]"]
  node_parser["DIB parser<br/>[dib-parser.ts]"]
  node_rules["Merchant rules<br/>[repo.ts]"]
end

subgraph group_web["Dashboard and APIs"]
  node_dashboard["Finance dashboard<br/>[page.tsx]"]
  node_transactions_ui["Transaction editor"]
  node_stats_api["Spending statistics APIs"]
  node_transaction_api["Transaction APIs"]
  node_category_api["Category APIs"]
  node_rule_api["Rule APIs"]
  node_admin["Admin recategorization<br/>[route.ts]"]
end

subgraph group_identity["Identity and persistence"]
  node_postgres[("Postgres")]
  node_auth_ui["Login interface<br/>[login-client.tsx]"]
  node_auth_api["Auth APIs"]
  node_authorization["App authorization<br/>[auth.ts]"]
  node_supabase["Supabase Auth"]
end

subgraph group_video["Promotional video"]
  node_ad["Finance showcase composition<br/>[DIBFinanceAd.tsx]"]
  node_hook["Hook scene<br/>[Scene1_Hook.tsx]"]
  node_dashboard_scene["Dashboard scene"]
  node_graph_scene["Spending graph scene<br/>[Scene3_Graph.tsx]"]
  node_category_scene["Categories scene"]
  node_transactions_scene["Transactions scene"]
  node_automation_scene["Automation scene"]
  node_cta_scene["Call-to-action scene<br/>[Scene7_CTA.tsx]"]
  node_background["Animated background<br/>[Background.tsx]"]
  node_glass["Glass card<br/>[GlassCard.tsx]"]
  node_counter["Animated counter"]
  node_theme["Video theme<br/>[theme.ts]"]
end

node_gmail(("DIB Gmail"))
node_script["Gmail Apps Script"]

node_gmail -.->|"supplies emails"| node_script
node_script -.->|"posts batches"| node_ingest_api
node_ingest_api -.->|"parses payload"| node_parser
node_ingest_api -.->|"dedupes and stores"| node_postgres
node_ingest_api -.->|"categorizes merchants"| node_rules
node_dashboard -.->|"requests trends"| node_stats_api
node_dashboard -.->|"requests transactions"| node_transaction_api
node_transactions_ui -.->|"edits transactions"| node_transaction_api
node_dashboard -.->|"manages categories"| node_category_api
node_dashboard -.->|"manages rules"| node_rule_api
node_admin -.->|"recategorizes"| node_rules
node_transaction_api -.->|"reads and writes"| node_postgres
node_stats_api -.->|"reads spending data"| node_postgres
node_category_api -.->|"reads and writes"| node_postgres
node_rule_api -.->|"reads and writes"| node_postgres
node_auth_ui -.->|"submits credentials"| node_auth_api
node_auth_api -.->|"authenticates"| node_supabase
node_auth_api -.->|"checks access"| node_authorization
node_authorization -.->|"checks approved users"| node_postgres
node_ad -->|"sequences"| node_hook
node_ad -->|"sequences"| node_dashboard_scene
node_ad -->|"sequences"| node_graph_scene
node_ad -->|"sequences"| node_category_scene
node_ad -->|"sequences"| node_transactions_scene
node_ad -->|"sequences"| node_automation_scene
node_ad -->|"sequences"| node_cta_scene
node_dashboard_scene -->|"renders"| node_background
node_dashboard_scene -->|"renders"| node_counter
node_graph_scene -->|"renders"| node_background
node_graph_scene -->|"renders"| node_glass
node_category_scene -->|"renders"| node_background
node_category_scene -->|"renders"| node_glass
node_transactions_scene -->|"renders"| node_background
node_transactions_scene -->|"renders"| node_glass
node_automation_scene -->|"renders"| node_background
node_automation_scene -->|"renders"| node_glass
node_hook -->|"renders"| node_background
node_cta_scene -->|"renders"| node_background
node_background -->|"uses palette"| node_theme
node_glass -->|"uses palette"| node_theme

click node_ingest_api "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/app/api/ingest/dib/route.ts"
click node_parser "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/lib/dib-parser.ts"
click node_rules "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/lib/repo.ts"
click node_dashboard "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/app/dashboard/page.tsx"
click node_transactions_ui "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/components/transactions-table-client.tsx"
click node_stats_api "https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/stats"
click node_transaction_api "https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/transactions"
click node_category_api "https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/categories"
click node_rule_api "https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/rules"
click node_admin "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/app/api/admin/recategorize/route.ts"
click node_auth_ui "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/components/login-client.tsx"
click node_auth_api "https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/auth"
click node_authorization "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/lib/auth.ts"
click node_ad "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/DIBFinanceAd.tsx"
click node_hook "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene1_Hook.tsx"
click node_dashboard_scene "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene2_Dashboard.tsx"
click node_graph_scene "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene3_Graph.tsx"
click node_category_scene "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene4_Categories.tsx"
click node_transactions_scene "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene5_Transactions.tsx"
click node_automation_scene "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene6_Automation.tsx"
click node_cta_scene "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene7_CTA.tsx"
click node_background "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/components/Background.tsx"
click node_glass "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/components/GlassCard.tsx"
click node_counter "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/components/AnimatedCounter.tsx"
click node_theme "https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/theme.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_ingest_api,node_parser,node_rules toneBlue
class node_dashboard,node_transactions_ui,node_stats_api,node_transaction_api,node_category_api,node_rule_api,node_admin toneAmber
class node_postgres,node_auth_ui,node_auth_api,node_authorization,node_supabase toneMint
class node_ad,node_hook,node_dashboard_scene,node_graph_scene,node_category_scene,node_transactions_scene,node_automation_scene,node_cta_scene,node_background,node_glass,node_counter,node_theme toneRose
class node_gmail,node_script toneIndigo
```

## Components

### Ingest and categorization

- [DIB ingest API](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/app/api/ingest/dib/route.ts): `apps/web/src/app/api/ingest/dib/route.ts`
- [DIB parser](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/lib/dib-parser.ts): `apps/web/src/lib/dib-parser.ts`
- [Merchant rules](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/lib/repo.ts): `apps/web/src/lib/repo.ts`

### Dashboard and APIs

- [Finance dashboard](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/app/dashboard/page.tsx): `apps/web/src/app/dashboard/page.tsx`
- [Transaction editor](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/components/transactions-table-client.tsx): `apps/web/src/components/transactions-table-client.tsx`
- [Spending statistics APIs](https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/stats): `apps/web/src/app/api/stats`
- [Transaction APIs](https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/transactions): `apps/web/src/app/api/transactions`
- [Category APIs](https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/categories): `apps/web/src/app/api/categories`
- [Rule APIs](https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/rules): `apps/web/src/app/api/rules`
- [Admin recategorization](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/app/api/admin/recategorize/route.ts): `apps/web/src/app/api/admin/recategorize/route.ts`

### Identity and persistence

- **Postgres**
- [Login interface](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/components/login-client.tsx): `apps/web/src/components/login-client.tsx`
- [Auth APIs](https://github.com/dilshodimomov/finance-tracker/tree/main/apps/web/src/app/api/auth): `apps/web/src/app/api/auth`
- [App authorization](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/web/src/lib/auth.ts): `apps/web/src/lib/auth.ts`
- **Supabase Auth**

### Promotional video

- [Finance showcase composition](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/DIBFinanceAd.tsx): `apps/remotion/src/compositions/DIBFinanceAd.tsx`
- [Hook scene](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene1_Hook.tsx): `apps/remotion/src/compositions/scenes/Scene1_Hook.tsx`
- [Dashboard scene](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene2_Dashboard.tsx): `apps/remotion/src/compositions/scenes/Scene2_Dashboard.tsx`
- [Spending graph scene](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene3_Graph.tsx): `apps/remotion/src/compositions/scenes/Scene3_Graph.tsx`
- [Categories scene](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene4_Categories.tsx): `apps/remotion/src/compositions/scenes/Scene4_Categories.tsx`
- [Transactions scene](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene5_Transactions.tsx): `apps/remotion/src/compositions/scenes/Scene5_Transactions.tsx`
- [Automation scene](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene6_Automation.tsx): `apps/remotion/src/compositions/scenes/Scene6_Automation.tsx`
- [Call-to-action scene](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/compositions/scenes/Scene7_CTA.tsx): `apps/remotion/src/compositions/scenes/Scene7_CTA.tsx`
- [Animated background](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/components/Background.tsx): `apps/remotion/src/components/Background.tsx`
- [Glass card](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/components/GlassCard.tsx): `apps/remotion/src/components/GlassCard.tsx`
- [Animated counter](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/components/AnimatedCounter.tsx): `apps/remotion/src/components/AnimatedCounter.tsx`
- [Video theme](https://github.com/dilshodimomov/finance-tracker/blob/main/apps/remotion/src/theme.ts): `apps/remotion/src/theme.ts`

### Other components

- **DIB Gmail**
- **Gmail Apps Script**

## Connections

- DIB Gmail → Gmail Apps Script: supplies emails
- Gmail Apps Script → DIB ingest API: posts batches
- DIB ingest API → DIB parser: parses payload
- DIB ingest API → Postgres: dedupes and stores
- DIB ingest API → Merchant rules: categorizes merchants
- Finance dashboard → Spending statistics APIs: requests trends
- Finance dashboard → Transaction APIs: requests transactions
- Transaction editor → Transaction APIs: edits transactions
- Finance dashboard → Category APIs: manages categories
- Finance dashboard → Rule APIs: manages rules
- Admin recategorization → Merchant rules: recategorizes
- Transaction APIs → Postgres: reads and writes
- Spending statistics APIs → Postgres: reads spending data
- Category APIs → Postgres: reads and writes
- Rule APIs → Postgres: reads and writes
- Login interface → Auth APIs: submits credentials
- Auth APIs → Supabase Auth: authenticates
- Auth APIs → App authorization: checks access
- App authorization → Postgres: checks approved users
- Finance showcase composition → Hook scene: sequences (evidence: `apps/remotion/src/compositions/DIBFinanceAd.tsx`)
- Finance showcase composition → Dashboard scene: sequences (evidence: `apps/remotion/src/compositions/DIBFinanceAd.tsx`)
- Finance showcase composition → Spending graph scene: sequences (evidence: `apps/remotion/src/compositions/DIBFinanceAd.tsx`)
- Finance showcase composition → Categories scene: sequences (evidence: `apps/remotion/src/compositions/DIBFinanceAd.tsx`)
- Finance showcase composition → Transactions scene: sequences (evidence: `apps/remotion/src/compositions/DIBFinanceAd.tsx`)
- Finance showcase composition → Automation scene: sequences (evidence: `apps/remotion/src/compositions/DIBFinanceAd.tsx`)
- Finance showcase composition → Call-to-action scene: sequences (evidence: `apps/remotion/src/compositions/DIBFinanceAd.tsx`)
- Dashboard scene → Animated background: renders (evidence: `apps/remotion/src/compositions/scenes/Scene2_Dashboard.tsx`)
- Dashboard scene → Animated counter: renders (evidence: `apps/remotion/src/compositions/scenes/Scene2_Dashboard.tsx`)
- Spending graph scene → Animated background: renders (evidence: `apps/remotion/src/compositions/scenes/Scene3_Graph.tsx`)
- Spending graph scene → Glass card: renders (evidence: `apps/remotion/src/compositions/scenes/Scene3_Graph.tsx`)
- Categories scene → Animated background: renders (evidence: `apps/remotion/src/compositions/scenes/Scene4_Categories.tsx`)
- Categories scene → Glass card: renders (evidence: `apps/remotion/src/compositions/scenes/Scene4_Categories.tsx`)
- Transactions scene → Animated background: renders (evidence: `apps/remotion/src/compositions/scenes/Scene5_Transactions.tsx`)
- Transactions scene → Glass card: renders (evidence: `apps/remotion/src/compositions/scenes/Scene5_Transactions.tsx`)
- Automation scene → Animated background: renders (evidence: `apps/remotion/src/compositions/scenes/Scene6_Automation.tsx`)
- Automation scene → Glass card: renders (evidence: `apps/remotion/src/compositions/scenes/Scene6_Automation.tsx`)
- Hook scene → Animated background: renders (evidence: `apps/remotion/src/compositions/scenes/Scene1_Hook.tsx`)
- Call-to-action scene → Animated background: renders (evidence: `apps/remotion/src/compositions/scenes/Scene7_CTA.tsx`)
- Animated background → Video theme: uses palette (evidence: `apps/remotion/src/components/Background.tsx`)
- Glass card → Video theme: uses palette (evidence: `apps/remotion/src/components/GlassCard.tsx`)
