# divin-kumar/dn_app_main architecture

> Architecture diagram of the GitHub repository divin-kumar/dn_app_main, 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/divin-kumar/dn_app_main
- Repository: https://github.com/divin-kumar/dn_app_main

## Overview

LifeHub is a personal life-and-finance workspace. A user enters through the protected app shell, works with moments and their activities or memories, and tracks income and expenses; dashboard and insights provide review. Zustand stores mediate domain state and local repositories persist it in Dexie, with guest data and optional cloud sync/backup capabilities. The graph preserves documented settings, attachments, PWA, and reporting branches. Some page and service implementations were not sampled, so their connections are included only where the README or SOURCE INDEX supports them.

Main entry points: [`src/App.jsx`](https://github.com/divin-kumar/dn_app_main/blob/main/src/App.jsx) (App routing), [`src/store/useEventStore.js`](https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useEventStore.js) (Event state), [`src/repositories`](https://github.com/divin-kumar/dn_app_main/tree/main/src/repositories) (Domain repositories), [`src/services/cloudSyncService.js`](https://github.com/divin-kumar/dn_app_main/blob/main/src/services/cloudSyncService.js) (Cloud sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_auth["Authentication<br/>[AuthContext.jsx]"]
  node_dashboard["Dashboard"]
  node_insights["Insights<br/>[Insights.jsx]"]
  node_pwa["PWA updates"]
end

subgraph group_life["Life planning"]
  node_events["Moments and activities<br/>[Events.jsx]"]
  node_workspace["Event workspace"]
  node_activity_ui["Activity UI<br/>[ActivityList.jsx]"]
  node_attachments["Memories and attachments<br/>[Attachments.jsx]"]
end

subgraph group_finance["Finance and settings"]
  node_financials["Financial overview<br/>[Financials.jsx]"]
  node_expenses["Expense records<br/>[Expenses.jsx]"]
  node_income["Income records<br/>[Income.jsx]"]
  node_settings["Settings and code lists<br/>[Settings.jsx]"]
end

subgraph group_data["State and persistence"]
  node_app_store["App state<br/>[useAppStore.js]"]
  node_event_store["Event state<br/>[useEventStore.js]"]
  node_expense_store["Expense state<br/>[useExpenseStore.js]"]
  node_income_store["Income state<br/>[useIncomeStore.js]"]
  node_repositories["Domain repositories"]
  node_database[("Local database<br/>[index.js]")]
end

subgraph group_continuity["Backup and sync"]
  node_backup["Backup and restore<br/>[backupService.js]"]
  node_cloud_sync["Cloud sync"]
  node_google_drive["Google Drive"]
  node_icloud["iCloud"]
end

node_user(("User / guest"))

node_user -->|"opens"| node_app
node_app -->|"wraps routes"| node_auth
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_events
node_app -->|"routes to"| node_workspace
node_app -->|"routes to"| node_financials
node_user -->|"manages moments"| node_events
node_events -->|"updates state"| node_event_store
node_workspace -->|"reads state"| node_event_store
node_workspace -->|"renders"| node_activity_ui
node_activity_ui -->|"shows status"| node_attachments
node_user -->|"reviews finances"| node_financials
node_financials -->|"routes to"| node_income
node_financials -->|"routes to"| node_expenses
node_expenses -->|"updates state"| node_expense_store
node_income -->|"updates state"| node_income_store
node_user -->|"configures"| node_settings
node_settings -->|"updates preferences"| node_app_store
node_dashboard -.->|"summarizes events"| node_event_store
node_dashboard -.->|"summarizes finances"| node_expense_store
node_insights -.->|"reviews records"| node_event_store
node_insights -.->|"reviews records"| node_expense_store
node_app_store -->|"persists settings"| node_repositories
node_event_store -->|"reads and writes"| node_repositories
node_expense_store -->|"reads and writes"| node_repositories
node_income_store -->|"manages records"| node_repositories
node_repositories -->|"reads and writes"| node_database
node_user -->|"exports or restores"| node_backup
node_backup -->|"backs up data"| node_database
node_cloud_sync -->|"creates and restores artifacts"| node_backup
node_cloud_sync -.->|"syncs optionally"| node_google_drive
node_cloud_sync -.->|"syncs optionally"| node_icloud
node_user -.->|"initiates sync"| node_cloud_sync
node_app -.->|"offers updates"| node_pwa

click node_app "https://github.com/divin-kumar/dn_app_main/blob/main/src/App.jsx"
click node_auth "https://github.com/divin-kumar/dn_app_main/blob/main/src/context/AuthContext.jsx"
click node_dashboard "https://github.com/divin-kumar/dn_app_main/blob/main/src/features/dashboard/components/DashboardOverview.jsx"
click node_insights "https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Insights.jsx"
click node_events "https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Events.jsx"
click node_workspace "https://github.com/divin-kumar/dn_app_main/blob/main/src/features/events/components/EventWorkspaceShell.jsx"
click node_activity_ui "https://github.com/divin-kumar/dn_app_main/blob/main/src/components/events/ActivityList.jsx"
click node_attachments "https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Attachments.jsx"
click node_financials "https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Financials.jsx"
click node_expenses "https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Expenses.jsx"
click node_income "https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Income.jsx"
click node_settings "https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Settings.jsx"
click node_app_store "https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useAppStore.js"
click node_event_store "https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useEventStore.js"
click node_expense_store "https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useExpenseStore.js"
click node_income_store "https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useIncomeStore.js"
click node_repositories "https://github.com/divin-kumar/dn_app_main/tree/main/src/repositories"
click node_database "https://github.com/divin-kumar/dn_app_main/blob/main/src/database/index.js"
click node_backup "https://github.com/divin-kumar/dn_app_main/blob/main/src/services/backupService.js"
click node_cloud_sync "https://github.com/divin-kumar/dn_app_main/blob/main/src/services/cloudSyncService.js"
click node_pwa "https://github.com/divin-kumar/dn_app_main/blob/main/src/utils/serviceWorkerUpdate.js"

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_app,node_auth,node_dashboard,node_insights,node_pwa,node_user toneBlue
class node_events,node_workspace,node_activity_ui,node_attachments toneAmber
class node_financials,node_expenses,node_income,node_settings toneMint
class node_app_store,node_event_store,node_expense_store,node_income_store,node_repositories,node_database toneRose
class node_backup,node_cloud_sync,node_google_drive,node_icloud toneIndigo
```

## Components

### App experience

- [App routing](https://github.com/divin-kumar/dn_app_main/blob/main/src/App.jsx): `src/App.jsx`
- [Authentication](https://github.com/divin-kumar/dn_app_main/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Dashboard](https://github.com/divin-kumar/dn_app_main/blob/main/src/features/dashboard/components/DashboardOverview.jsx): `src/features/dashboard/components/DashboardOverview.jsx`
- [Insights](https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Insights.jsx): `src/pages/Insights.jsx`
- [PWA updates](https://github.com/divin-kumar/dn_app_main/blob/main/src/utils/serviceWorkerUpdate.js): `src/utils/serviceWorkerUpdate.js`

### Life planning

- [Moments and activities](https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Events.jsx): `src/pages/Events.jsx`
- [Event workspace](https://github.com/divin-kumar/dn_app_main/blob/main/src/features/events/components/EventWorkspaceShell.jsx): `src/features/events/components/EventWorkspaceShell.jsx`
- [Activity UI](https://github.com/divin-kumar/dn_app_main/blob/main/src/components/events/ActivityList.jsx): `src/components/events/ActivityList.jsx`
- [Memories and attachments](https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Attachments.jsx): `src/pages/Attachments.jsx`

### Finance and settings

- [Financial overview](https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Financials.jsx): `src/pages/Financials.jsx`
- [Expense records](https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Expenses.jsx): `src/pages/Expenses.jsx`
- [Income records](https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Income.jsx): `src/pages/Income.jsx`
- [Settings and code lists](https://github.com/divin-kumar/dn_app_main/blob/main/src/pages/Settings.jsx): `src/pages/Settings.jsx`

### State and persistence

- [App state](https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useAppStore.js): `src/store/useAppStore.js`
- [Event state](https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useEventStore.js): `src/store/useEventStore.js`
- [Expense state](https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useExpenseStore.js): `src/store/useExpenseStore.js`
- [Income state](https://github.com/divin-kumar/dn_app_main/blob/main/src/store/useIncomeStore.js): `src/store/useIncomeStore.js`
- [Domain repositories](https://github.com/divin-kumar/dn_app_main/tree/main/src/repositories): `src/repositories`
- [Local database](https://github.com/divin-kumar/dn_app_main/blob/main/src/database/index.js): `src/database/index.js`

### Backup and sync

- [Backup and restore](https://github.com/divin-kumar/dn_app_main/blob/main/src/services/backupService.js): `src/services/backupService.js`
- [Cloud sync](https://github.com/divin-kumar/dn_app_main/blob/main/src/services/cloudSyncService.js): `src/services/cloudSyncService.js`
- **Google Drive**
- **iCloud**

### Other components

- **User / guest**

## Connections

- User / guest → App routing: opens
- App routing → Authentication: wraps routes (evidence: `src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `src/App.jsx`)
- App routing → Moments and activities: routes to (evidence: `src/App.jsx`)
- App routing → Event workspace: routes to (evidence: `src/App.jsx`)
- App routing → Financial overview: routes to (evidence: `src/App.jsx`)
- User / guest → Moments and activities: manages moments
- Moments and activities → Event state: updates state (evidence: `src/pages/Events.jsx`)
- Event workspace → Event state: reads state (evidence: `src/features/events/components/EventWorkspaceShell.jsx`)
- Event workspace → Activity UI: renders (evidence: `src/features/events/components/EventWorkspaceShell.jsx`)
- Activity UI → Memories and attachments: shows status (evidence: `src/components/events/ActivityList.jsx`)
- User / guest → Financial overview: reviews finances
- Financial overview → Income records: routes to (evidence: `src/App.jsx`)
- Financial overview → Expense records: routes to (evidence: `src/App.jsx`)
- Expense records → Expense state: updates state
- Income records → Income state: updates state
- User / guest → Settings and code lists: configures
- Settings and code lists → App state: updates preferences
- Dashboard → Event state: summarizes events
- Dashboard → Expense state: summarizes finances
- Insights → Event state: reviews records
- Insights → Expense state: reviews records
- App state → Domain repositories: persists settings (evidence: `src/store/useAppStore.js`)
- Event state → Domain repositories: reads and writes (evidence: `src/store/useEventStore.js`)
- Expense state → Domain repositories: reads and writes (evidence: `src/store/useExpenseStore.js`)
- Income state → Domain repositories: manages records
- Domain repositories → Local database: reads and writes (evidence: `src/repositories/attachmentRepository.js`)
- User / guest → Backup and restore: exports or restores
- Backup and restore → Local database: backs up data (evidence: `src/services/backupService.js`)
- Cloud sync → Backup and restore: creates and restores artifacts (evidence: `src/services/cloudSyncService.js`)
- Cloud sync → Google Drive: syncs optionally (evidence: `src/services/cloudSyncService.js`)
- Cloud sync → iCloud: syncs optionally (evidence: `src/services/cloudSyncService.js`)
- User / guest → Cloud sync: initiates sync
- App routing → PWA updates: offers updates
