# varunkainth/expense-tracker architecture

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

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

## Overview

Expense Tracker is a local-first mobile app for recording personal spending and work reimbursements, then reviewing or exporting records. Users enter personal expenses or work-expense details through separate app areas; records are stored in SQLite and can support period-based reports. Settings cover encrypted backup and restore, app security, and appearance. The README documents these product capabilities, while sampled source confirms SQLite initialization, repository access, and personal-expense operations; wiring from unsampled screens and services is therefore not drawn.

Main entry points: [`src/database/client.ts`](https://github.com/varunkainth/expense-tracker/blob/main/src/database/client.ts) (Local SQLite), [`src/repositories/personal/expense.repository.ts`](https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/personal/expense.repository.ts) (Expense records), [`src/repositories/company/daily-allowance.repository.ts`](https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/company/daily-allowance.repository.ts) (Work repositories), [`src/repositories/personal/category.repository.ts`](https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/personal/category.repository.ts) (Expense categories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_personal["Personal expenses"]
  node_personal_area["Personal screens<br/>[history.tsx]"]
  node_personal_entry["Expense entry<br/>[add-expense.tsx]"]
  node_quick_add["Quick add<br/>[quick-add.tsx]"]
  node_expense_detail["Expense detail<br/>[&#91;id&#93;.tsx]"]
  node_personal_repo["Expense records"]
end

subgraph group_work["Work expenses"]
  node_company_area["Company screens<br/>[company.tsx]"]
  node_employee_screen["Employee details<br/>[employee.tsx]"]
  node_work_entry["Work expense forms"]
  node_work_repos["Work repositories"]
end

subgraph group_data["Local data"]
  node_sqlite[("Local SQLite<br/>[client.ts]")]
  node_schema["Schema migrations<br/>[migrations.ts]"]
  node_category_repo["Expense categories"]
end

subgraph group_reports["Reports and protection"]
  node_reports_area["Report export"]
  node_attendance_pdf["Attendance PDF"]
  node_backup["Backup and restore<br/>[backup.service.ts]"]
  node_backup_crypto["Backup encryption"]
  node_security_settings["Security settings<br/>[security.tsx]"]
  node_auth["Device authentication<br/>[auth.service.ts]"]
  node_appearance["Appearance settings<br/>[appearance.tsx]"]
  node_secure_store["Secure storage<br/>[storage.service.ts]"]
end

node_user(("App user"))
node_device_db[("Device database")]

node_user -->|"browses"| node_personal_area
node_user -->|"records"| node_personal_entry
node_user -->|"records"| node_quick_add
node_user -->|"opens"| node_company_area
node_user -->|"manages"| node_employee_screen
node_user -->|"records"| node_work_entry
node_user -->|"exports"| node_reports_area
node_user -->|"exports"| node_attendance_pdf
node_user -->|"backs up"| node_backup
node_user -->|"configures"| node_security_settings
node_user -->|"personalizes"| node_appearance
node_personal_repo -->|"reads/writes"| node_sqlite
node_work_repos -->|"reads/writes"| node_sqlite
node_category_repo -->|"reads/writes"| node_sqlite
node_sqlite -->|"opens"| node_device_db
node_sqlite -->|"runs migrations"| node_schema

click node_personal_area "https://github.com/varunkainth/expense-tracker/blob/main/src/app/(personal)/history.tsx"
click node_personal_entry "https://github.com/varunkainth/expense-tracker/blob/main/src/app/(personal)/add-expense.tsx"
click node_quick_add "https://github.com/varunkainth/expense-tracker/blob/main/src/app/(personal)/quick-add.tsx"
click node_expense_detail "https://github.com/varunkainth/expense-tracker/blob/main/src/app/(personal)/expense/%5Bid%5D.tsx"
click node_personal_repo "https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/personal/expense.repository.ts"
click node_company_area "https://github.com/varunkainth/expense-tracker/blob/main/src/app/(tabs)/company.tsx"
click node_employee_screen "https://github.com/varunkainth/expense-tracker/blob/main/src/app/(company)/employee.tsx"
click node_work_entry "https://github.com/varunkainth/expense-tracker/blob/main/src/app/(company)/local-conveyance.tsx"
click node_work_repos "https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/company/daily-allowance.repository.ts"
click node_sqlite "https://github.com/varunkainth/expense-tracker/blob/main/src/database/client.ts"
click node_schema "https://github.com/varunkainth/expense-tracker/blob/main/src/database/migrations.ts"
click node_category_repo "https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/personal/category.repository.ts"
click node_reports_area "https://github.com/varunkainth/expense-tracker/blob/main/src/services/export-company-excel.service.ts"
click node_attendance_pdf "https://github.com/varunkainth/expense-tracker/blob/main/src/services/export-attendance-pdf.service.ts"
click node_backup "https://github.com/varunkainth/expense-tracker/blob/main/src/services/backup.service.ts"
click node_backup_crypto "https://github.com/varunkainth/expense-tracker/blob/main/src/services/security/backup-crypto.service.ts"
click node_security_settings "https://github.com/varunkainth/expense-tracker/blob/main/src/app/settings/security.tsx"
click node_auth "https://github.com/varunkainth/expense-tracker/blob/main/src/services/auth.service.ts"
click node_appearance "https://github.com/varunkainth/expense-tracker/blob/main/src/app/settings/appearance.tsx"
click node_secure_store "https://github.com/varunkainth/expense-tracker/blob/main/src/services/storage.service.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_personal_area,node_personal_entry,node_quick_add,node_expense_detail,node_personal_repo,node_user toneBlue
class node_company_area,node_employee_screen,node_work_entry,node_work_repos,node_device_db toneAmber
class node_sqlite,node_schema,node_category_repo toneMint
class node_reports_area,node_attendance_pdf,node_backup,node_backup_crypto,node_security_settings,node_auth,node_appearance,node_secure_store toneRose
```

## Components

### Personal expenses

- [Personal screens](https://github.com/varunkainth/expense-tracker/blob/main/src/app/(personal)/history.tsx): `src/app/(personal)/history.tsx`
- [Expense entry](https://github.com/varunkainth/expense-tracker/blob/main/src/app/(personal)/add-expense.tsx): `src/app/(personal)/add-expense.tsx`
- [Quick add](https://github.com/varunkainth/expense-tracker/blob/main/src/app/(personal)/quick-add.tsx): `src/app/(personal)/quick-add.tsx`
- [Expense detail](https://github.com/varunkainth/expense-tracker/blob/main/src/app/(personal)/expense/%5Bid%5D.tsx): `src/app/(personal)/expense/[id].tsx`
- [Expense records](https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/personal/expense.repository.ts): `src/repositories/personal/expense.repository.ts`

### Work expenses

- [Company screens](https://github.com/varunkainth/expense-tracker/blob/main/src/app/(tabs)/company.tsx): `src/app/(tabs)/company.tsx`
- [Employee details](https://github.com/varunkainth/expense-tracker/blob/main/src/app/(company)/employee.tsx): `src/app/(company)/employee.tsx`
- [Work expense forms](https://github.com/varunkainth/expense-tracker/blob/main/src/app/(company)/local-conveyance.tsx): `src/app/(company)/local-conveyance.tsx`
- [Work repositories](https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/company/daily-allowance.repository.ts): `src/repositories/company/daily-allowance.repository.ts`

### Local data

- [Local SQLite](https://github.com/varunkainth/expense-tracker/blob/main/src/database/client.ts): `src/database/client.ts`
- [Schema migrations](https://github.com/varunkainth/expense-tracker/blob/main/src/database/migrations.ts): `src/database/migrations.ts`
- [Expense categories](https://github.com/varunkainth/expense-tracker/blob/main/src/repositories/personal/category.repository.ts): `src/repositories/personal/category.repository.ts`

### Reports and protection

- [Report export](https://github.com/varunkainth/expense-tracker/blob/main/src/services/export-company-excel.service.ts): `src/services/export-company-excel.service.ts`
- [Attendance PDF](https://github.com/varunkainth/expense-tracker/blob/main/src/services/export-attendance-pdf.service.ts): `src/services/export-attendance-pdf.service.ts`
- [Backup and restore](https://github.com/varunkainth/expense-tracker/blob/main/src/services/backup.service.ts): `src/services/backup.service.ts`
- [Backup encryption](https://github.com/varunkainth/expense-tracker/blob/main/src/services/security/backup-crypto.service.ts): `src/services/security/backup-crypto.service.ts`
- [Security settings](https://github.com/varunkainth/expense-tracker/blob/main/src/app/settings/security.tsx): `src/app/settings/security.tsx`
- [Device authentication](https://github.com/varunkainth/expense-tracker/blob/main/src/services/auth.service.ts): `src/services/auth.service.ts`
- [Appearance settings](https://github.com/varunkainth/expense-tracker/blob/main/src/app/settings/appearance.tsx): `src/app/settings/appearance.tsx`
- [Secure storage](https://github.com/varunkainth/expense-tracker/blob/main/src/services/storage.service.ts): `src/services/storage.service.ts`

### Other components

- **App user**
- **Device database**

## Connections

- App user → Personal screens: browses
- App user → Expense entry: records
- App user → Quick add: records
- App user → Company screens: opens
- App user → Employee details: manages
- App user → Work expense forms: records
- App user → Report export: exports
- App user → Attendance PDF: exports
- App user → Backup and restore: backs up
- App user → Security settings: configures
- App user → Appearance settings: personalizes
- Expense records → Local SQLite: reads/writes
- Work repositories → Local SQLite: reads/writes
- Expense categories → Local SQLite: reads/writes
- Local SQLite → Device database: opens
- Local SQLite → Schema migrations: runs migrations
