# natiman1/cashflow architecture

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

- Interactive diagram: https://gitdiagram.com/natiman1/cashflow
- Repository: https://github.com/natiman1/cashflow

## Overview

CashFlow is a personal-finance tracker, with the web application as its documented primary product and a mobile app also present in the tree. The user journey is account access, recording and categorizing transactions, setting category budgets, then reviewing dashboard and statistical summaries; settings and exports support ongoing use. The graph includes the shared auth and database layers and documented alert capability. Several action and screen implementations were not sampled, so their internal calls are not asserted.

Main entry points: [`apps/web/src/actions`](https://github.com/natiman1/cashflow/tree/main/apps/web/src/actions) (Server actions), [`packages/db/src/schema/transactions.ts`](https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/transactions.ts) (Transactions table), [`packages/db/src/schema/budgets.ts`](https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/budgets.ts) (Budgets table), [`packages/db/src/schema/categories.ts`](https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/categories.ts) (Categories table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_landing["Product landing<br/>[page.tsx]"]
  node_web_auth["Web sign-in"]
  node_mobile_auth["Mobile sign-in"]
end

subgraph group_finance["Finance features"]
  node_transactions["Transactions<br/>[page.tsx]"]
  node_categories["Categories<br/>[page.tsx]"]
  node_budgets["Budgets<br/>[budgets.ts]"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_statistics["Statistics<br/>[page.tsx]"]
  node_settings["Settings<br/>[page.tsx]"]
  node_csv_export["CSV export<br/>[exportToCsv.tsx]"]
  node_budget_alerts["Budget alerts<br/>[budget-alert.ts]"]
end

subgraph group_services["Application services"]
  node_auth_api["Auth API route<br/>[route.ts]"]
  node_auth_config["Auth configuration<br/>[index.ts]"]
  node_data_actions["Server actions"]
  node_email["Email service<br/>[email.ts]"]
end

subgraph group_storage["Persistence"]
  node_postgres[("PostgreSQL")]
  node_auth_tables[("Auth tables<br/>[auth.ts]")]
  node_transaction_table[("Transactions table<br/>[transactions.ts]")]
  node_category_table[("Categories table<br/>[categories.ts]")]
  node_budget_table[("Budgets table<br/>[budgets.ts]")]
  node_relations["Schema relations<br/>[relations.ts]"]
end

node_user(("User"))

node_user -->|"visits"| node_landing
node_user -->|"signs in"| node_web_auth
node_user -.->|"uses"| node_mobile_auth
node_landing -.->|"offers access"| node_web_auth
node_web_auth -.->|"authenticates"| node_auth_api
node_auth_api -.->|"routes to"| node_auth_config
node_auth_config -->|"uses schema"| node_auth_tables
node_auth_config -.->|"persists auth"| node_postgres
node_transactions -->|"loads transactions"| node_data_actions
node_transactions -->|"loads categories"| node_categories
node_dashboard -->|"loads summaries"| node_data_actions
node_statistics -->|"loads statistics"| node_data_actions
node_data_actions -.->|"reads and writes"| node_transaction_table
node_data_actions -.->|"reads and writes"| node_category_table
node_data_actions -.->|"reads and writes"| node_budget_table
node_data_actions -.->|"queries"| node_postgres
node_transaction_table -->|"references user"| node_auth_tables
node_transaction_table -->|"references category"| node_category_table
node_budget_table -->|"references user"| node_auth_tables
node_budget_table -->|"references category"| node_category_table
node_relations -->|"relates"| node_transaction_table
node_relations -->|"relates"| node_budget_table
node_relations -->|"relates"| node_category_table
node_user -->|"records activity"| node_transactions
node_user -->|"sets limits"| node_budgets
node_user -->|"manages preferences"| node_settings
node_user -->|"reviews trends"| node_statistics
node_user -->|"exports data"| node_csv_export
node_budgets -.->|"triggers alerts"| node_budget_alerts
node_budget_alerts -.->|"may notify"| node_email

click node_landing "https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/page.tsx"
click node_web_auth "https://github.com/natiman1/cashflow/tree/main/apps/web/src/app/(auth)"
click node_mobile_auth "https://github.com/natiman1/cashflow/tree/main/apps/mobile/app/(auth)"
click node_transactions "https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/transactions/page.tsx"
click node_categories "https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/categories/page.tsx"
click node_budgets "https://github.com/natiman1/cashflow/blob/main/apps/web/src/actions/budgets.ts"
click node_dashboard "https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/page.tsx"
click node_statistics "https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/statistics/page.tsx"
click node_settings "https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/settings/page.tsx"
click node_csv_export "https://github.com/natiman1/cashflow/blob/main/apps/web/src/components/transactions/exportToCsv.tsx"
click node_budget_alerts "https://github.com/natiman1/cashflow/blob/main/apps/web/src/lib/notifications/budget-alert.ts"
click node_auth_api "https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/api/auth/%5B...all%5D/route.ts"
click node_auth_config "https://github.com/natiman1/cashflow/blob/main/packages/auth/src/index.ts"
click node_data_actions "https://github.com/natiman1/cashflow/tree/main/apps/web/src/actions"
click node_email "https://github.com/natiman1/cashflow/blob/main/apps/web/src/lib/email.ts"
click node_auth_tables "https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/auth.ts"
click node_transaction_table "https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/transactions.ts"
click node_category_table "https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/categories.ts"
click node_budget_table "https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/budgets.ts"
click node_relations "https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/relations.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_landing,node_web_auth,node_mobile_auth,node_user toneBlue
class node_transactions,node_categories,node_budgets,node_dashboard,node_statistics,node_settings,node_csv_export,node_budget_alerts toneAmber
class node_auth_api,node_auth_config,node_data_actions,node_email toneMint
class node_postgres,node_auth_tables,node_transaction_table,node_category_table,node_budget_table,node_relations toneRose
```

## Components

### Web experience

- [Product landing](https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/page.tsx): `apps/web/src/app/page.tsx`
- [Web sign-in](https://github.com/natiman1/cashflow/tree/main/apps/web/src/app/(auth)): `apps/web/src/app/(auth)`
- [Mobile sign-in](https://github.com/natiman1/cashflow/tree/main/apps/mobile/app/(auth)): `apps/mobile/app/(auth)`

### Finance features

- [Transactions](https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/transactions/page.tsx): `apps/web/src/app/dashboard/transactions/page.tsx`
- [Categories](https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/categories/page.tsx): `apps/web/src/app/dashboard/categories/page.tsx`
- [Budgets](https://github.com/natiman1/cashflow/blob/main/apps/web/src/actions/budgets.ts): `apps/web/src/actions/budgets.ts`
- [Dashboard](https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/page.tsx): `apps/web/src/app/dashboard/page.tsx`
- [Statistics](https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/statistics/page.tsx): `apps/web/src/app/dashboard/statistics/page.tsx`
- [Settings](https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/dashboard/settings/page.tsx): `apps/web/src/app/dashboard/settings/page.tsx`
- [CSV export](https://github.com/natiman1/cashflow/blob/main/apps/web/src/components/transactions/exportToCsv.tsx): `apps/web/src/components/transactions/exportToCsv.tsx`
- [Budget alerts](https://github.com/natiman1/cashflow/blob/main/apps/web/src/lib/notifications/budget-alert.ts): `apps/web/src/lib/notifications/budget-alert.ts`

### Application services

- [Auth API route](https://github.com/natiman1/cashflow/blob/main/apps/web/src/app/api/auth/%5B...all%5D/route.ts): `apps/web/src/app/api/auth/[...all]/route.ts`
- [Auth configuration](https://github.com/natiman1/cashflow/blob/main/packages/auth/src/index.ts): `packages/auth/src/index.ts`
- [Server actions](https://github.com/natiman1/cashflow/tree/main/apps/web/src/actions): `apps/web/src/actions`
- [Email service](https://github.com/natiman1/cashflow/blob/main/apps/web/src/lib/email.ts): `apps/web/src/lib/email.ts`

### Persistence

- **PostgreSQL**
- [Auth tables](https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/auth.ts): `packages/db/src/schema/auth.ts`
- [Transactions table](https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/transactions.ts): `packages/db/src/schema/transactions.ts`
- [Categories table](https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/categories.ts): `packages/db/src/schema/categories.ts`
- [Budgets table](https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/budgets.ts): `packages/db/src/schema/budgets.ts`
- [Schema relations](https://github.com/natiman1/cashflow/blob/main/packages/db/src/schema/relations.ts): `packages/db/src/schema/relations.ts`

### Other components

- **User**

## Connections

- User → Product landing: visits (evidence: `apps/web/src/app/page.tsx`)
- User → Web sign-in: signs in
- User → Mobile sign-in: uses
- Product landing → Web sign-in: offers access
- Web sign-in → Auth API route: authenticates
- Auth API route → Auth configuration: routes to
- Auth configuration → Auth tables: uses schema (evidence: `packages/auth/src/index.ts`)
- Auth configuration → PostgreSQL: persists auth
- Transactions → Server actions: loads transactions (evidence: `apps/web/src/app/dashboard/transactions/page.tsx`)
- Transactions → Categories: loads categories (evidence: `apps/web/src/app/dashboard/transactions/page.tsx`)
- Dashboard → Server actions: loads summaries (evidence: `apps/web/src/app/dashboard/page.tsx`)
- Statistics → Server actions: loads statistics (evidence: `apps/web/src/app/dashboard/statistics/page.tsx`)
- Server actions → Transactions table: reads and writes
- Server actions → Categories table: reads and writes
- Server actions → Budgets table: reads and writes
- Server actions → PostgreSQL: queries
- Transactions table → Auth tables: references user (evidence: `packages/db/src/schema/transactions.ts`)
- Transactions table → Categories table: references category (evidence: `packages/db/src/schema/transactions.ts`)
- Budgets table → Auth tables: references user (evidence: `packages/db/src/schema/budgets.ts`)
- Budgets table → Categories table: references category (evidence: `packages/db/src/schema/budgets.ts`)
- Schema relations → Transactions table: relates (evidence: `packages/db/src/schema/relations.ts`)
- Schema relations → Budgets table: relates (evidence: `packages/db/src/schema/relations.ts`)
- Schema relations → Categories table: relates (evidence: `packages/db/src/schema/relations.ts`)
- User → Transactions: records activity
- User → Budgets: sets limits
- User → Settings: manages preferences
- User → Statistics: reviews trends
- User → CSV export: exports data
- Budgets → Budget alerts: triggers alerts
- Budget alerts → Email service: may notify
