# mearslanahmed/spendwise-react-native architecture

> Architecture diagram of the GitHub repository mearslanahmed/spendwise-react-native, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mearslanahmed/spendwise-react-native
- Repository: https://github.com/mearslanahmed/spendwise-react-native

## Overview

SpendWise is a cross-platform personal-finance app. Users authenticate, record and scan transactions, organize funds into wallets and budgets, then review spending analytics and AI advice; they can also manage subscriptions, reminders, exports, privacy, and theme settings. Firebase provides authentication and synced data, while receipt processing uses the documented external AI backend. The graph combines README-described features with source-index-supported relationships; unsampled screens and services are represented by their exact tree paths, without claiming their internal calls were inspected.

Main entry points: [`config/firebase.ts`](https://github.com/mearslanahmed/spendwise-react-native/blob/main/config/firebase.ts) (Firebase services), [`contexts/authContext.tsx`](https://github.com/mearslanahmed/spendwise-react-native/blob/main/contexts/authContext.tsx) (Authentication state), [`services/transactionService.ts`](https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/transactionService.ts) (Transaction operations), [`services/subscriptionService.ts`](https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/subscriptionService.ts) (Subscription processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and app shell"]
  node_auth["Sign-in and onboarding<br/>[login.tsx]"]
  node_routing["App navigation<br/>[_layout.tsx]"]
  node_auth_context["Authentication state<br/>[authContext.tsx]"]
  node_theme["Dynamic theming<br/>[themeContext.tsx]"]
end

subgraph group_finance["Finance tracking"]
  node_home["Finance dashboard<br/>[home.tsx]"]
  node_transaction["Transaction entry"]
  node_transaction_service["Transaction operations"]
  node_wallets["Wallets and transfers<br/>[wallet.tsx]"]
  node_wallet_service["Wallet operations<br/>[walletService.ts]"]
  node_budgets["Budget tracking<br/>[budgetModal.tsx]"]
  node_data_context["Synced finance state<br/>[dataContext.tsx]"]
end

subgraph group_insights["Insights and AI"]
  node_analytics["Spending analytics<br/>[statistics.tsx]"]
  node_advisor["AI financial advisor<br/>[aiAdvisor.tsx]"]
  node_ai_service["AI and receipt service<br/>[aiService.ts]"]
end

subgraph group_engagement["Account and engagement"]
  node_subscriptions["Subscription management"]
  node_subscription_service["Subscription processing"]
  node_notifications["Push reminders"]
  node_settings["Privacy and settings<br/>[settingsModal.tsx]"]
  node_export["CSV export<br/>[exportModal.tsx]"]
  node_widget["Android home widget<br/>[SpendWiseWidget.kt]"]
end

subgraph group_platform["Platform services"]
  node_ai_backend{{"AI backend API"}}
  node_firebase[("Firebase services<br/>[firebase.ts]")]
  node_image_service["Image storage<br/>[imageService.ts]"]
end

node_user(("App user"))

node_user -->|"signs in"| node_auth
node_auth -->|"authenticates through"| node_auth_context
node_auth_context -->|"uses authentication"| node_firebase
node_auth_context -->|"protects routes"| node_routing
node_routing -.->|"opens dashboard"| node_home
node_home -.->|"starts tracking"| node_transaction
node_transaction -.->|"saves transaction"| node_transaction_service
node_transaction_service -->|"reads and writes"| node_firebase
node_transaction_service -->|"uploads receipt"| node_image_service
node_image_service -.->|"uses app services"| node_firebase
node_wallets -.->|"manages wallets"| node_wallet_service
node_wallet_service -->|"stores wallet data"| node_firebase
node_budgets -.->|"tracks budgets"| node_firebase
node_analytics -->|"reads synced data"| node_data_context
node_data_context -->|"listens for updates"| node_firebase
node_advisor -.->|"requests advice"| node_ai_service
node_ai_service -->|"processes receipt"| node_ai_backend
node_subscriptions -.->|"manages bills"| node_subscription_service
node_subscription_service -->|"updates subscriptions"| node_firebase
node_subscription_service -->|"schedules reminders"| node_notifications
node_settings -->|"sets appearance"| node_theme
node_theme -->|"syncs preference"| node_firebase
node_export -.->|"exports history"| node_data_context
node_widget -->|"shows spending"| node_user

click node_auth "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(auth)/login.tsx"
click node_routing "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/_layout.tsx"
click node_home "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(tabs)/home.tsx"
click node_transaction "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/transactionModal.tsx"
click node_transaction_service "https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/transactionService.ts"
click node_wallets "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(tabs)/wallet.tsx"
click node_wallet_service "https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/walletService.ts"
click node_budgets "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/budgetModal.tsx"
click node_analytics "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(tabs)/statistics.tsx"
click node_advisor "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(tabs)/aiAdvisor.tsx"
click node_ai_service "https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/aiService.ts"
click node_subscriptions "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/manageSubscriptionModal.tsx"
click node_subscription_service "https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/subscriptionService.ts"
click node_notifications "https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/notificationService.ts"
click node_settings "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/settingsModal.tsx"
click node_export "https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/exportModal.tsx"
click node_widget "https://github.com/mearslanahmed/spendwise-react-native/blob/main/targets/widget/android/SpendWiseWidget.kt"
click node_auth_context "https://github.com/mearslanahmed/spendwise-react-native/blob/main/contexts/authContext.tsx"
click node_data_context "https://github.com/mearslanahmed/spendwise-react-native/blob/main/contexts/dataContext.tsx"
click node_firebase "https://github.com/mearslanahmed/spendwise-react-native/blob/main/config/firebase.ts"
click node_image_service "https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/imageService.ts"
click node_theme "https://github.com/mearslanahmed/spendwise-react-native/blob/main/contexts/themeContext.tsx"

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_auth,node_routing,node_auth_context,node_theme,node_user toneBlue
class node_home,node_transaction,node_transaction_service,node_wallets,node_wallet_service,node_budgets,node_data_context toneAmber
class node_analytics,node_advisor,node_ai_service toneMint
class node_subscriptions,node_subscription_service,node_notifications,node_settings,node_export,node_widget toneRose
class node_ai_backend,node_firebase,node_image_service toneIndigo
```

## Components

### Identity and app shell

- [Sign-in and onboarding](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(auth)/login.tsx): `app/(auth)/login.tsx`
- [App navigation](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/_layout.tsx): `app/_layout.tsx`
- [Authentication state](https://github.com/mearslanahmed/spendwise-react-native/blob/main/contexts/authContext.tsx): `contexts/authContext.tsx`
- [Dynamic theming](https://github.com/mearslanahmed/spendwise-react-native/blob/main/contexts/themeContext.tsx): `contexts/themeContext.tsx`

### Finance tracking

- [Finance dashboard](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(tabs)/home.tsx): `app/(tabs)/home.tsx`
- [Transaction entry](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/transactionModal.tsx): `app/(modals)/transactionModal.tsx`
- [Transaction operations](https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/transactionService.ts): `services/transactionService.ts`
- [Wallets and transfers](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(tabs)/wallet.tsx): `app/(tabs)/wallet.tsx`
- [Wallet operations](https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/walletService.ts): `services/walletService.ts`
- [Budget tracking](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/budgetModal.tsx): `app/(modals)/budgetModal.tsx`
- [Synced finance state](https://github.com/mearslanahmed/spendwise-react-native/blob/main/contexts/dataContext.tsx): `contexts/dataContext.tsx`

### Insights and AI

- [Spending analytics](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(tabs)/statistics.tsx): `app/(tabs)/statistics.tsx`
- [AI financial advisor](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(tabs)/aiAdvisor.tsx): `app/(tabs)/aiAdvisor.tsx`
- [AI and receipt service](https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/aiService.ts): `services/aiService.ts`

### Account and engagement

- [Subscription management](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/manageSubscriptionModal.tsx): `app/(modals)/manageSubscriptionModal.tsx`
- [Subscription processing](https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/subscriptionService.ts): `services/subscriptionService.ts`
- [Push reminders](https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/notificationService.ts): `services/notificationService.ts`
- [Privacy and settings](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/settingsModal.tsx): `app/(modals)/settingsModal.tsx`
- [CSV export](https://github.com/mearslanahmed/spendwise-react-native/blob/main/app/(modals)/exportModal.tsx): `app/(modals)/exportModal.tsx`
- [Android home widget](https://github.com/mearslanahmed/spendwise-react-native/blob/main/targets/widget/android/SpendWiseWidget.kt): `targets/widget/android/SpendWiseWidget.kt`

### Platform services

- **AI backend API**
- [Firebase services](https://github.com/mearslanahmed/spendwise-react-native/blob/main/config/firebase.ts): `config/firebase.ts`
- [Image storage](https://github.com/mearslanahmed/spendwise-react-native/blob/main/services/imageService.ts): `services/imageService.ts`

### Other components

- **App user**

## Connections

- App user → Sign-in and onboarding: signs in
- Sign-in and onboarding → Authentication state: authenticates through
- Authentication state → Firebase services: uses authentication (evidence: `contexts/authContext.tsx`)
- Authentication state → App navigation: protects routes (evidence: `contexts/authContext.tsx`)
- App navigation → Finance dashboard: opens dashboard
- Finance dashboard → Transaction entry: starts tracking
- Transaction entry → Transaction operations: saves transaction
- Transaction operations → Firebase services: reads and writes (evidence: `services/transactionService.ts`)
- Transaction operations → Image storage: uploads receipt (evidence: `services/transactionService.ts`)
- Image storage → Firebase services: uses app services
- Wallets and transfers → Wallet operations: manages wallets
- Wallet operations → Firebase services: stores wallet data (evidence: `services/walletService.ts`)
- Budget tracking → Firebase services: tracks budgets
- Spending analytics → Synced finance state: reads synced data (evidence: `app/(tabs)/statistics.tsx`)
- Synced finance state → Firebase services: listens for updates (evidence: `contexts/dataContext.tsx`)
- AI financial advisor → AI and receipt service: requests advice
- AI and receipt service → AI backend API: processes receipt
- Subscription management → Subscription processing: manages bills
- Subscription processing → Firebase services: updates subscriptions (evidence: `services/subscriptionService.ts`)
- Subscription processing → Push reminders: schedules reminders (evidence: `services/subscriptionService.ts`)
- Privacy and settings → Dynamic theming: sets appearance (evidence: `app/(modals)/settingsModal.tsx`)
- Dynamic theming → Firebase services: syncs preference (evidence: `contexts/themeContext.tsx`)
- CSV export → Synced finance state: exports history
- Android home widget → App user: shows spending
