# 7urish/mushaf architecture

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

- Interactive diagram: https://gitdiagram.com/7urish/mushaf
- Repository: https://github.com/7urish/mushaf

## Overview

المصحف is an Arabic Quran-reading web app. Its main user journey starts at the surah index, where readers can search or choose a surah and continue into a verse-based reading view; audio playback, settings, bookmarks, and saved reading position support that journey. The repository also contains authentication, connector-backed app data, multiplayer, and preview-embed capabilities. The README documents the reading, index, and listening features; relationships for several additional subsystems are not shown in the sampled excerpts, so they are represented without speculative links.

Main entry points: [`src/components/quran/home-view.tsx`](https://github.com/7urish/mushaf/blob/home/src/components/quran/home-view.tsx) (Surah index), [`src/components/quran/reader-view.tsx`](https://github.com/7urish/mushaf/blob/home/src/components/quran/reader-view.tsx) (Reader), [`src/components/quran/audio.tsx`](https://github.com/7urish/mushaf/blob/home/src/components/quran/audio.tsx) (Audio player), [`src/lib/quran.ts`](https://github.com/7urish/mushaf/blob/home/src/lib/quran.ts) (Quran utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_quran["Quran experience"]
  node_reader["Reader<br/>[reader-view.tsx]"]
  node_index["Surah index<br/>[home-view.tsx]"]
  node_audio["Audio player<br/>[audio.tsx]"]
  node_settings["Reader settings<br/>[settings.tsx]"]
  node_indexroute["Index route<br/>[index.tsx]"]
  node_readroute["Reading route<br/>[$surah.tsx]"]
  node_root["App root<br/>[__root.tsx]"]
end

subgraph group_shared["Reading services"]
  node_quranlogic["Quran utilities<br/>[quran.ts]"]
  node_metadata["Quran metadata<br/>[meta.ts]"]
  node_preferences[("Reader preferences<br/>[store.ts]")]
  node_text["Quran text<br/>[text.json]"]
end

subgraph group_identity["Identity and data"]
  node_authprovider["Auth provider<br/>[provider.tsx]"]
  node_authserver["Auth server<br/>[server.ts]"]
  node_database[("Auth database<br/>[db.ts]")]
  node_connectors["Connector client<br/>[client.server.ts]"]
end

subgraph group_platform["App integrations"]
  node_multiplayer["Peer multiplayer<br/>[p2p.ts]"]
  node_previewcomponent["Preview bridge mount"]
  node_previewbridge["Preview bridge"]
  node_pwa["PWA middleware<br/>[grok-pwa.ts]"]
end

node_visitor(("Reader"))
node_audiohost[("Audio CDN")]
node_previewhost(("Preview host"))

node_visitor -->|"opens"| node_indexroute
node_indexroute -->|"renders"| node_index
node_index -->|"navigates"| node_readroute
node_readroute -->|"renders"| node_reader
node_index -->|"searches and indexes"| node_quranlogic
node_reader -->|"locates verses"| node_quranlogic
node_quranlogic -->|"reads"| node_metadata
node_index -->|"renders player"| node_audio
node_reader -->|"renders controls"| node_audio
node_index -->|"opens"| node_settings
node_reader -->|"opens"| node_settings
node_index -->|"reads preferences"| node_preferences
node_reader -->|"reads preferences"| node_preferences
node_audio -->|"reads playback settings"| node_preferences
node_root -->|"provides audio context"| node_audio
node_root -->|"wraps routes"| node_authprovider
node_authserver -->|"initializes and uses"| node_database
node_audio -.->|"requests audio"| node_audiohost
node_previewcomponent -->|"installs bridge"| node_previewbridge
node_previewbridge -->|"exchanges messages"| node_previewhost

click node_reader "https://github.com/7urish/mushaf/blob/home/src/components/quran/reader-view.tsx"
click node_index "https://github.com/7urish/mushaf/blob/home/src/components/quran/home-view.tsx"
click node_audio "https://github.com/7urish/mushaf/blob/home/src/components/quran/audio.tsx"
click node_settings "https://github.com/7urish/mushaf/blob/home/src/components/quran/settings.tsx"
click node_quranlogic "https://github.com/7urish/mushaf/blob/home/src/lib/quran.ts"
click node_metadata "https://github.com/7urish/mushaf/blob/home/src/data/meta.ts"
click node_preferences "https://github.com/7urish/mushaf/blob/home/src/lib/store.ts"
click node_text "https://github.com/7urish/mushaf/blob/home/src/data/text.json"
click node_indexroute "https://github.com/7urish/mushaf/blob/home/src/routes/index.tsx"
click node_readroute "https://github.com/7urish/mushaf/blob/home/src/routes/read/%24surah.tsx"
click node_root "https://github.com/7urish/mushaf/blob/home/src/routes/__root.tsx"
click node_authprovider "https://github.com/7urish/mushaf/blob/home/src/lib/auth/provider.tsx"
click node_authserver "https://github.com/7urish/mushaf/blob/home/src/lib/auth/server.ts"
click node_database "https://github.com/7urish/mushaf/blob/home/src/lib/db.ts"
click node_connectors "https://github.com/7urish/mushaf/blob/home/src/lib/app-data/client.server.ts"
click node_multiplayer "https://github.com/7urish/mushaf/blob/home/src/lib/multiplayer/p2p.ts"
click node_previewcomponent "https://github.com/7urish/mushaf/blob/home/src/components/preview-host-bridge.tsx"
click node_previewbridge "https://github.com/7urish/mushaf/blob/home/src/lib/preview-host-bridge.ts"
click node_pwa "https://github.com/7urish/mushaf/blob/home/server/middleware/grok-pwa.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_reader,node_index,node_audio,node_settings,node_indexroute,node_readroute,node_root,node_previewhost toneBlue
class node_quranlogic,node_metadata,node_preferences,node_text,node_audiohost toneAmber
class node_authprovider,node_authserver,node_database,node_connectors toneMint
class node_multiplayer,node_previewcomponent,node_previewbridge,node_pwa toneRose
class node_visitor toneIndigo
```

## Components

### Quran experience

- [Reader](https://github.com/7urish/mushaf/blob/home/src/components/quran/reader-view.tsx): `src/components/quran/reader-view.tsx`
- [Surah index](https://github.com/7urish/mushaf/blob/home/src/components/quran/home-view.tsx): `src/components/quran/home-view.tsx`
- [Audio player](https://github.com/7urish/mushaf/blob/home/src/components/quran/audio.tsx): `src/components/quran/audio.tsx`
- [Reader settings](https://github.com/7urish/mushaf/blob/home/src/components/quran/settings.tsx): `src/components/quran/settings.tsx`
- [Index route](https://github.com/7urish/mushaf/blob/home/src/routes/index.tsx): `src/routes/index.tsx`
- [Reading route](https://github.com/7urish/mushaf/blob/home/src/routes/read/%24surah.tsx): `src/routes/read/$surah.tsx`
- [App root](https://github.com/7urish/mushaf/blob/home/src/routes/__root.tsx): `src/routes/__root.tsx`

### Reading services

- [Quran utilities](https://github.com/7urish/mushaf/blob/home/src/lib/quran.ts): `src/lib/quran.ts`
- [Quran metadata](https://github.com/7urish/mushaf/blob/home/src/data/meta.ts): `src/data/meta.ts`
- [Reader preferences](https://github.com/7urish/mushaf/blob/home/src/lib/store.ts): `src/lib/store.ts`
- [Quran text](https://github.com/7urish/mushaf/blob/home/src/data/text.json): `src/data/text.json`

### Identity and data

- [Auth provider](https://github.com/7urish/mushaf/blob/home/src/lib/auth/provider.tsx): `src/lib/auth/provider.tsx`
- [Auth server](https://github.com/7urish/mushaf/blob/home/src/lib/auth/server.ts): `src/lib/auth/server.ts`
- [Auth database](https://github.com/7urish/mushaf/blob/home/src/lib/db.ts): `src/lib/db.ts`
- [Connector client](https://github.com/7urish/mushaf/blob/home/src/lib/app-data/client.server.ts): `src/lib/app-data/client.server.ts`

### App integrations

- [Peer multiplayer](https://github.com/7urish/mushaf/blob/home/src/lib/multiplayer/p2p.ts): `src/lib/multiplayer/p2p.ts`
- [Preview bridge mount](https://github.com/7urish/mushaf/blob/home/src/components/preview-host-bridge.tsx): `src/components/preview-host-bridge.tsx`
- [Preview bridge](https://github.com/7urish/mushaf/blob/home/src/lib/preview-host-bridge.ts): `src/lib/preview-host-bridge.ts`
- [PWA middleware](https://github.com/7urish/mushaf/blob/home/server/middleware/grok-pwa.ts): `server/middleware/grok-pwa.ts`

### Other components

- **Reader**
- **Audio CDN**
- **Preview host**

## Connections

- Reader → Index route: opens (evidence: `src/routes/index.tsx`)
- Index route → Surah index: renders (evidence: `src/routes/index.tsx`)
- Surah index → Reading route: navigates (evidence: `src/components/quran/home-view.tsx`)
- Reading route → Reader: renders (evidence: `src/routes/read/$surah.tsx`)
- Surah index → Quran utilities: searches and indexes (evidence: `src/components/quran/home-view.tsx`)
- Reader → Quran utilities: locates verses (evidence: `src/components/quran/reader-view.tsx`)
- Quran utilities → Quran metadata: reads (evidence: `src/lib/quran.ts`)
- Surah index → Audio player: renders player (evidence: `src/components/quran/home-view.tsx`)
- Reader → Audio player: renders controls (evidence: `src/components/quran/reader-view.tsx`)
- Surah index → Reader settings: opens (evidence: `src/components/quran/home-view.tsx`)
- Reader → Reader settings: opens (evidence: `src/components/quran/reader-view.tsx`)
- Surah index → Reader preferences: reads preferences (evidence: `src/components/quran/home-view.tsx`)
- Reader → Reader preferences: reads preferences (evidence: `src/components/quran/reader-view.tsx`)
- Audio player → Reader preferences: reads playback settings (evidence: `src/components/quran/audio.tsx`)
- App root → Audio player: provides audio context (evidence: `src/routes/__root.tsx`)
- App root → Auth provider: wraps routes (evidence: `src/routes/__root.tsx`)
- Auth server → Auth database: initializes and uses (evidence: `src/lib/auth/server.ts`)
- Audio player → Audio CDN: requests audio
- Preview bridge mount → Preview bridge: installs bridge (evidence: `src/components/preview-host-bridge.tsx`)
- Preview bridge → Preview host: exchanges messages (evidence: `src/lib/preview-host-bridge.ts`)
