# mastershiru/gastify-app architecture

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

- Interactive diagram: https://gitdiagram.com/mastershiru/gastify-app
- Repository: https://github.com/mastershiru/gastify-app

## Overview

Financial Tracker is an Expo mobile app backed by FastAPI. Users authenticate, add expenses manually or scan receipts, review extracted receipt data, and view combined expense reports; separate app capabilities include savings tracking, local reminders and inbox, and biometric/PIN locking. Receipt parsing and OCR are distinct backend stages before review and confirmation. Source excerpts substantiate the backend receipt/OCR path and app entry-point wiring; several mobile screens and feature implementations are represented from the tree and README, so their internal call details are not inferred.

Main entry points: [`mobile/services/api.ts`](https://github.com/mastershiru/gastify-app/blob/main/mobile/services/api.ts) (API client), [`backend/app/api/v1/receipts.py`](https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/receipts.py) (Receipt API), [`backend/main.py`](https://github.com/mastershiru/gastify-app/blob/main/backend/main.py) (API entry point), [`backend/app/db/models`](https://github.com/mastershiru/gastify-app/tree/main/backend/app/db/models) (Financial records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_authui["Sign in / register<br/>[login.tsx]"]
  node_onboarding["Onboarding<br/>[index.tsx]"]
  node_home["Dashboard / reports<br/>[index.tsx]"]
  node_manual["Manual expense<br/>[manual-expense.tsx]"]
  node_receiptui["Receipt screens<br/>[receipts.tsx]"]
  node_review["Receipt review<br/>[receipt-review.tsx]"]
  node_notificationsui["Notification inbox<br/>[notifications.tsx]"]
  node_profile["Savings / profile<br/>[profile.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_authstore["Auth token storage<br/>[authStorage.ts]"]
end

subgraph group_api["Backend API"]
  node_api_entry["API entry point<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_expenses["Expense API<br/>[expenses.py]"]
end

subgraph group_receipt["Receipt processing"]
  node_receipt_api["Receipt API<br/>[receipts.py]"]
  node_ocr_api["OCR API<br/>[ocr.py]"]
  node_ocr_service["OCR extraction<br/>[ocr_service.py]"]
  node_parser["Receipt parser<br/>[receipt_parser.py]"]
end

subgraph group_data["Financial data"]
  node_dbsession["Database session<br/>[session.py]"]
  node_models[("Financial records")]
  node_savings[("Savings records")]
end

subgraph group_device["Device features"]
  node_app_lock["App lock gate<br/>[AppLockGate.tsx]"]
  node_localnotify["Local notifications<br/>[notifications.ts]"]
end

node_person(("App user"))
node_ocrprovider["OCR engine"]

node_person -->|"signs in"| node_authui
node_authui -.->|"sends credentials"| node_api_client
node_api_client -->|"stores tokens"| node_authstore
node_person -->|"sets up account"| node_onboarding
node_person -->|"views reports"| node_home
node_person -->|"enters expense"| node_manual
node_person -->|"scans receipt"| node_receiptui
node_receiptui -.->|"uploads receipt"| node_api_client
node_api_client -.->|"calls receipt routes"| node_receipt_api
node_receipt_api -->|"extracts text"| node_ocr_service
node_ocr_service -.->|"runs OCR"| node_ocrprovider
node_receipt_api -->|"parses OCR result"| node_parser
node_receipt_api -.->|"returns draft"| node_review
node_review -.->|"confirms draft"| node_api_client
node_receipt_api -->|"persists receipt"| node_models
node_person -->|"reviews totals"| node_home
node_manual -.->|"submits expense"| node_api_client
node_api_client -.->|"calls expense routes"| node_expenses
node_expenses -->|"reads / writes"| node_models
node_person -->|"tracks savings"| node_profile
node_profile -.->|"updates savings"| node_api_client
node_profile -.->|"manages separately"| node_savings
node_person -->|"checks reminders"| node_notificationsui
node_localnotify -.->|"feeds inbox"| node_notificationsui
node_person -->|"unlocks app"| node_app_lock
node_api_entry -->|"registers router"| node_auth
node_api_entry -->|"registers router"| node_expenses
node_api_entry -->|"registers router"| node_ocr_api
node_api_entry -->|"registers router"| node_receipt_api
node_auth -->|"uses session"| node_dbsession
node_auth -->|"loads user"| node_models
node_receipt_api -->|"uses session"| node_dbsession
node_dbsession -.->|"stores records"| node_models
node_ocr_api -->|"uses OCR"| node_ocr_service
node_ocr_api -->|"parses receipt"| node_parser

click node_authui "https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(auth)/login.tsx"
click node_onboarding "https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(onboarding)/index.tsx"
click node_home "https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/index.tsx"
click node_manual "https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/manual-expense.tsx"
click node_receiptui "https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/receipts.tsx"
click node_review "https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/receipt-review.tsx"
click node_notificationsui "https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/notifications.tsx"
click node_profile "https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/profile.tsx"
click node_api_client "https://github.com/mastershiru/gastify-app/blob/main/mobile/services/api.ts"
click node_authstore "https://github.com/mastershiru/gastify-app/blob/main/mobile/services/authStorage.ts"
click node_app_lock "https://github.com/mastershiru/gastify-app/blob/main/mobile/components/AppLockGate.tsx"
click node_localnotify "https://github.com/mastershiru/gastify-app/blob/main/mobile/services/notifications.ts"
click node_api_entry "https://github.com/mastershiru/gastify-app/blob/main/backend/main.py"
click node_auth "https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/auth.py"
click node_expenses "https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/expenses.py"
click node_receipt_api "https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/receipts.py"
click node_ocr_api "https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/ocr.py"
click node_ocr_service "https://github.com/mastershiru/gastify-app/blob/main/backend/app/services/ocr_service.py"
click node_parser "https://github.com/mastershiru/gastify-app/blob/main/backend/app/services/receipt_parser.py"
click node_dbsession "https://github.com/mastershiru/gastify-app/blob/main/backend/app/db/session.py"
click node_models "https://github.com/mastershiru/gastify-app/tree/main/backend/app/db/models"
click node_savings "https://github.com/mastershiru/gastify-app/blob/main/backend/app/db/models/savings_transaction.py"

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_authui,node_onboarding,node_home,node_manual,node_receiptui,node_review,node_notificationsui,node_profile,node_api_client,node_authstore,node_person toneBlue
class node_api_entry,node_auth,node_expenses toneAmber
class node_receipt_api,node_ocr_api,node_ocr_service,node_parser toneMint
class node_dbsession,node_models,node_savings toneRose
class node_app_lock,node_localnotify,node_ocrprovider toneIndigo
```

## Components

### Mobile app

- [Sign in / register](https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(auth)/login.tsx): `mobile/app/(auth)/login.tsx`
- [Onboarding](https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(onboarding)/index.tsx): `mobile/app/(onboarding)/index.tsx`
- [Dashboard / reports](https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/index.tsx): `mobile/app/(tabs)/index.tsx`
- [Manual expense](https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/manual-expense.tsx): `mobile/app/(tabs)/manual-expense.tsx`
- [Receipt screens](https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/receipts.tsx): `mobile/app/(tabs)/receipts.tsx`
- [Receipt review](https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/receipt-review.tsx): `mobile/app/(tabs)/receipt-review.tsx`
- [Notification inbox](https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/notifications.tsx): `mobile/app/(tabs)/notifications.tsx`
- [Savings / profile](https://github.com/mastershiru/gastify-app/blob/main/mobile/app/(tabs)/profile.tsx): `mobile/app/(tabs)/profile.tsx`
- [API client](https://github.com/mastershiru/gastify-app/blob/main/mobile/services/api.ts): `mobile/services/api.ts`
- [Auth token storage](https://github.com/mastershiru/gastify-app/blob/main/mobile/services/authStorage.ts): `mobile/services/authStorage.ts`

### Backend API

- [API entry point](https://github.com/mastershiru/gastify-app/blob/main/backend/main.py): `backend/main.py`
- [Authentication](https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`
- [Expense API](https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/expenses.py): `backend/app/api/v1/expenses.py`

### Receipt processing

- [Receipt API](https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/receipts.py): `backend/app/api/v1/receipts.py`
- [OCR API](https://github.com/mastershiru/gastify-app/blob/main/backend/app/api/v1/ocr.py): `backend/app/api/v1/ocr.py`
- [OCR extraction](https://github.com/mastershiru/gastify-app/blob/main/backend/app/services/ocr_service.py): `backend/app/services/ocr_service.py`
- [Receipt parser](https://github.com/mastershiru/gastify-app/blob/main/backend/app/services/receipt_parser.py): `backend/app/services/receipt_parser.py`

### Financial data

- [Database session](https://github.com/mastershiru/gastify-app/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Financial records](https://github.com/mastershiru/gastify-app/tree/main/backend/app/db/models): `backend/app/db/models`
- [Savings records](https://github.com/mastershiru/gastify-app/blob/main/backend/app/db/models/savings_transaction.py): `backend/app/db/models/savings_transaction.py`

### Device features

- [App lock gate](https://github.com/mastershiru/gastify-app/blob/main/mobile/components/AppLockGate.tsx): `mobile/components/AppLockGate.tsx`
- [Local notifications](https://github.com/mastershiru/gastify-app/blob/main/mobile/services/notifications.ts): `mobile/services/notifications.ts`

### Other components

- **App user**
- **OCR engine**

## Connections

- App user → Sign in / register: signs in (evidence: `README.md`)
- Sign in / register → API client: sends credentials
- API client → Auth token storage: stores tokens (evidence: `mobile/services/api.ts`)
- App user → Onboarding: sets up account (evidence: `README.md`)
- App user → Dashboard / reports: views reports (evidence: `README.md`)
- App user → Manual expense: enters expense (evidence: `README.md`)
- App user → Receipt screens: scans receipt (evidence: `README.md`)
- Receipt screens → API client: uploads receipt
- API client → Receipt API: calls receipt routes
- Receipt API → OCR extraction: extracts text (evidence: `backend/app/api/v1/receipts.py`)
- OCR extraction → OCR engine: runs OCR
- Receipt API → Receipt parser: parses OCR result (evidence: `backend/app/api/v1/receipts.py`)
- Receipt API → Receipt review: returns draft
- Receipt review → API client: confirms draft
- Receipt API → Financial records: persists receipt (evidence: `backend/app/api/v1/receipts.py`)
- App user → Dashboard / reports: reviews totals (evidence: `README.md`)
- Manual expense → API client: submits expense
- API client → Expense API: calls expense routes
- Expense API → Financial records: reads / writes (evidence: `backend/app/api/v1/expenses.py`)
- App user → Savings / profile: tracks savings (evidence: `README.md`)
- Savings / profile → API client: updates savings
- Savings / profile → Savings records: manages separately
- App user → Notification inbox: checks reminders (evidence: `README.md`)
- Local notifications → Notification inbox: feeds inbox
- App user → App lock gate: unlocks app (evidence: `README.md`)
- API entry point → Authentication: registers router (evidence: `backend/main.py`)
- API entry point → Expense API: registers router (evidence: `backend/main.py`)
- API entry point → OCR API: registers router (evidence: `backend/main.py`)
- API entry point → Receipt API: registers router (evidence: `backend/main.py`)
- Authentication → Database session: uses session (evidence: `backend/app/api/v1/auth.py`)
- Authentication → Financial records: loads user (evidence: `backend/app/api/v1/auth.py`)
- Receipt API → Database session: uses session (evidence: `backend/app/api/v1/receipts.py`)
- Database session → Financial records: stores records
- OCR API → OCR extraction: uses OCR (evidence: `backend/app/api/v1/ocr.py`)
- OCR API → Receipt parser: parses receipt (evidence: `backend/app/api/v1/ocr.py`)
