# islamfakhri/nawy architecture

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

- Interactive diagram: https://gitdiagram.com/islamfakhri/nawy
- Repository: https://github.com/islamfakhri/nawy

## Overview

Nawy is an Arabic-first, local-first PWA for recording daily intentions. The main flow is: a person manages intentions in the app, which uses the data core and storage interface to persist them in IndexedDB; they can choose a daily intention, complete it, and review the archive and statistics. Other documented capabilities include JSON import/export, optional Google Drive backup, reminders, sharing, and offline use. Some feature links rely on README documentation because their implementation was not sampled; those edges cite the README.

Main entry points: [`app.js`](https://github.com/islamfakhri/nawy/blob/main/app.js) (Intention app), [`service-worker.js`](https://github.com/islamfakhri/nawy/blob/main/service-worker.js) (Service worker), [`src/ui/archive/entry.tsx`](https://github.com/islamfakhri/nawy/blob/main/src/ui/archive/entry.tsx) (Archive renderer), [`src/core/nawy-storage.ts`](https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-storage.ts) (Storage interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_daily["Daily practice"]
  node_app["Intention app<br/>[app.js]"]
  node_today["Today selection<br/>[TodayPickList.tsx]"]
  node_archive["Archive list<br/>[ArchiveList.tsx]"]
  node_archive_entry["Archive renderer<br/>[entry.tsx]"]
end

subgraph group_data["Data and persistence"]
  node_data_core["Data core<br/>[nawy-data.ts]"]
  node_storage_api["Storage interface<br/>[nawy-storage.ts]"]
  node_storage_adapter["Dexie adapter<br/>[nawy-storage.ts]"]
  node_indexeddb[("IndexedDB")]
end

subgraph group_backup["Backup and restore"]
  node_backup_api["Backup provider<br/>[nawy-backup.ts]"]
  node_drive_adapter["Drive adapter<br/>[nawy-backup.ts]"]
  node_google_drive[("Google Drive")]
  node_json_backup["JSON import/export<br/>[nawy-data.ts]"]
end

subgraph group_pwa["PWA experience"]
  node_worker["Service worker<br/>[service-worker.js]"]
  node_reminders["Daily reminders<br/>[service-worker.js]"]
  node_sharing["Image sharing<br/>[share.js]"]
  node_game["Break game<br/>[game.html]"]
end

node_person(("App user"))

node_person -->|"uses"| node_app
node_app -->|"uses"| node_data_core
node_app -->|"uses"| node_storage_api
node_storage_api -->|"implemented by"| node_storage_adapter
node_storage_adapter -->|"reads and writes"| node_indexeddb
node_app -->|"renders"| node_today
node_app -->|"renders"| node_archive_entry
node_archive_entry -->|"renders"| node_archive
node_archive_entry -->|"renders"| node_today
node_app -->|"uses"| node_backup_api
node_backup_api -->|"implemented by"| node_drive_adapter
node_drive_adapter -->|"calls API"| node_google_drive
node_app -->|"imports and exports"| node_json_backup
node_worker -->|"imports"| node_data_core
node_worker -->|"reads and writes"| node_indexeddb
node_worker -->|"dispatches"| node_reminders
node_app -->|"uses"| node_sharing
node_person -->|"opens"| node_game

click node_app "https://github.com/islamfakhri/nawy/blob/main/app.js"
click node_today "https://github.com/islamfakhri/nawy/blob/main/src/ui/archive/TodayPickList.tsx"
click node_archive "https://github.com/islamfakhri/nawy/blob/main/src/ui/archive/ArchiveList.tsx"
click node_archive_entry "https://github.com/islamfakhri/nawy/blob/main/src/ui/archive/entry.tsx"
click node_data_core "https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-data.ts"
click node_storage_api "https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-storage.ts"
click node_storage_adapter "https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-storage.ts"
click node_backup_api "https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-backup.ts"
click node_drive_adapter "https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-backup.ts"
click node_json_backup "https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-data.ts"
click node_worker "https://github.com/islamfakhri/nawy/blob/main/service-worker.js"
click node_reminders "https://github.com/islamfakhri/nawy/blob/main/service-worker.js"
click node_sharing "https://github.com/islamfakhri/nawy/blob/main/share.js"
click node_game "https://github.com/islamfakhri/nawy/blob/main/game.html"

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_today,node_archive,node_archive_entry,node_person toneBlue
class node_data_core,node_storage_api,node_storage_adapter,node_indexeddb toneAmber
class node_backup_api,node_drive_adapter,node_google_drive,node_json_backup toneMint
class node_worker,node_reminders,node_sharing,node_game toneRose
```

## Components

### Daily practice

- [Intention app](https://github.com/islamfakhri/nawy/blob/main/app.js): `app.js`
- [Today selection](https://github.com/islamfakhri/nawy/blob/main/src/ui/archive/TodayPickList.tsx): `src/ui/archive/TodayPickList.tsx`
- [Archive list](https://github.com/islamfakhri/nawy/blob/main/src/ui/archive/ArchiveList.tsx): `src/ui/archive/ArchiveList.tsx`
- [Archive renderer](https://github.com/islamfakhri/nawy/blob/main/src/ui/archive/entry.tsx): `src/ui/archive/entry.tsx`

### Data and persistence

- [Data core](https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-data.ts): `src/core/nawy-data.ts`
- [Storage interface](https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-storage.ts): `src/core/nawy-storage.ts`
- [Dexie adapter](https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-storage.ts): `src/core/nawy-storage.ts`
- **IndexedDB**

### Backup and restore

- [Backup provider](https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-backup.ts): `src/core/nawy-backup.ts`
- [Drive adapter](https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-backup.ts): `src/core/nawy-backup.ts`
- **Google Drive**
- [JSON import/export](https://github.com/islamfakhri/nawy/blob/main/src/core/nawy-data.ts): `src/core/nawy-data.ts`

### PWA experience

- [Service worker](https://github.com/islamfakhri/nawy/blob/main/service-worker.js): `service-worker.js`
- [Daily reminders](https://github.com/islamfakhri/nawy/blob/main/service-worker.js): `service-worker.js`
- [Image sharing](https://github.com/islamfakhri/nawy/blob/main/share.js): `share.js`
- [Break game](https://github.com/islamfakhri/nawy/blob/main/game.html): `game.html`

### Other components

- **App user**

## Connections

- App user → Intention app: uses (evidence: `README.md`)
- Intention app → Data core: uses (evidence: `README.md`)
- Intention app → Storage interface: uses (evidence: `README.md`)
- Storage interface → Dexie adapter: implemented by (evidence: `src/core/nawy-storage.ts`)
- Dexie adapter → IndexedDB: reads and writes (evidence: `src/core/nawy-storage.ts`)
- Intention app → Today selection: renders (evidence: `README.md`)
- Intention app → Archive renderer: renders (evidence: `README.md`)
- Archive renderer → Archive list: renders (evidence: `src/ui/archive/entry.tsx`)
- Archive renderer → Today selection: renders (evidence: `src/ui/archive/entry.tsx`)
- Intention app → Backup provider: uses (evidence: `README.md`)
- Backup provider → Drive adapter: implemented by (evidence: `src/core/nawy-backup.ts`)
- Drive adapter → Google Drive: calls API (evidence: `src/core/nawy-backup.ts`)
- Intention app → JSON import/export: imports and exports (evidence: `README.md`)
- Service worker → Data core: imports (evidence: `service-worker.js`)
- Service worker → IndexedDB: reads and writes (evidence: `service-worker.js`)
- Service worker → Daily reminders: dispatches (evidence: `service-worker.js`)
- Intention app → Image sharing: uses (evidence: `README.md`)
- App user → Break game: opens (evidence: `README.md`)
