# umerqureshi409/al-quran-kanzul-iman architecture

> Architecture diagram of the GitHub repository umerqureshi409/al-quran-kanzul-iman, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/umerqureshi409/al-quran-kanzul-iman
- Repository: https://github.com/umerqureshi409/al-quran-kanzul-iman

## Overview

##### Project type and purpose
- This is a full-stack SSR (server-side rendered) web application built with Next.js.
- Purpose: Provide a browsable Quran reading experience with Urdu translation (Kanzul Iman), plus features such as personalized reading schedules and an AI-powered helper via a Next.js API route.

##### File structure
- Top-level files:
- next.config.js, tsconfig.json, tailwind.config.js → build and framework configuration
- .env.local → environment variables for API keys or runtime flags
- src/app → Next.js App Router structure:
- page.tsx, layout.tsx, globals.scss → root layout and styles
- /api/ai/route.ts → serverless API endpoint for AI assistance
- /list, /read/surah/[surahID], /schedule, /developers, /terms, /ai → page routes
- src/components → reusable React components (UI library, navigation, cards, modals)
- src/app/rtk → Redux Toolkit store, slices, hooks for client-side state (reading list, schedule)
- public → static assets
- package.json → dependencies: next, react, tailwindcss, @reduxjs/toolkit, etc.

##### README
- Confirms Next.js (SSR), Tailwind CSS, Vercel deployment
- Features: full Quran text, translation, reading schedule, developer resources, responsive design
- No external database is mentioned—likely static JSON or client-side storage for schedules

a. Main components:
1. Client (Browser)
2. Next.js Server (SSR + API routes)
3. React Component Layer (Pages, UI components)
4. State Management Layer (Redux Toolkit store & slices)
5. Serverless Function (/api/ai) → AI Service
6. Static Data Source (Quran text + translation files under public or fetched externally)
7. Deployment Platform (Vercel)
b. Relationships & Interactions:
- Browser ↔ Next.js Server for initial page renders (SSR)
- Client → React components → RTK store for UI state
- Client → fetch calls to /api/ai → AI Service (e.g., OpenAI) → back to Client
- Pages (e.g., /read) read static data or call fetch endpoints to retrieve Quran text
- Schedule pages interact with RTK store, persisted to localStorage (or a lightweight backend if added later)
c. Architectural patterns & design principles:
- SSR (Next.js App Router) for performance & SEO
- Component-based design (separation of concerns: UI → components, business logic → RTK slices)
- Serverless architecture (API route isolated in /app/api)
- Single codebase deployment (monorepo on Vercel)
d. Key technologies/frameworks/libraries:
- Next.js (App Router, SSR, serverless functions)
- React (functional components, hooks)
- Redux Toolkit (store.ts, slices: listSlice, scheduleSlice, hooks.ts)
- Tailwind CSS (utility classes via tailwind.config.js)
- Vercel (hosting, serverless runtime)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["Client (Browser)"]:::external

    %% Next.js Server (SSR & App Router) on Vercel
    subgraph "Deployment Platform: Vercel"
        direction TB
        subgraph "Next.js Server (SSR & App Router)"
            direction TB
            SSR_Layout["Layout & Globals"]:::frontend
            subgraph "SSR Page Routes"
                direction TB
                Home["Home Page"]:::frontend
                ListPage["Quran List Page"]:::frontend
                ReadPage["Read Surah Page"]:::frontend
                SchedulePage["Reading Schedule Page"]:::frontend
                AIUIPage["AI Helper UI Page"]:::frontend
                DevPage["Developers Info Page"]:::frontend
                TermsPage["Terms & Conditions Page"]:::frontend
            end
            APIAI["API Route /api/ai"]:::api
        end
    end

    %% React Components Layer
    subgraph "React Component Layer"
        direction TB
        Navbar["Navbar"]:::frontend
        Sidebar["Sidebar"]:::frontend
        Provider["Provider"]:::frontend
        HomeComp["Home Component"]:::frontend
        ListComp["List Component"]:::frontend
        ScheduleComp["Schedule Component"]:::frontend
        ReadComp["Read Component"]:::frontend
        UI_Button["UI Button"]:::frontend
        UI_Card["UI Card"]:::frontend
        UI_Input["UI Input"]:::frontend
        UI_Modal["UI Modal"]:::frontend
        UI_SurahCard["UI SurahCard"]:::frontend
        UI_ScheduleCard["UI ScheduleCard"]:::frontend
        UI_Alert["UI Alert"]:::frontend
        UI_Loading["UI Loading"]:::frontend
        UI_SortButton["UI SortButton"]:::frontend
    end

    %% State Management Layer
    subgraph "State Management (RTK)"
        direction TB
        RTK["RTK Store"]:::state
        hooks["RTK Hooks"]:::state
        sliceList["listSlice"]:::state
        sliceSchedule["scheduleSlice"]:::state
    end

    %% Data & External Services
    StaticData["Static Data Source"]:::data
    AIService["External AI Service"]:::external

    %% Relationships
    Browser -->|"HTTP GET (SSR)"| Home
    Browser -->|"fetch /api/ai"| APIAI
    Home -->|"renders via"| SSR_Layout
    ListPage -->|"renders via"| SSR_Layout
    ReadPage -->|"renders via"| SSR_Layout
    SchedulePage -->|"renders via"| SSR_Layout
    AIUIPage -->|"renders via"| SSR_Layout
    DevPage -->|"renders via"| SSR_Layout
    TermsPage -->|"renders via"| SSR_Layout

    SSR_Layout -->|"fetch static data"| StaticData

    Browser -->|"hydrate"| Navbar
    Browser --> Sidebar
    Browser --> Provider
    Provider --> HomeComp
    Provider --> ListComp
    Provider --> ScheduleComp
    Provider --> ReadComp

    HomeComp --> UI_Card
    ListComp --> UI_SurahCard
    ScheduleComp --> UI_ScheduleCard
    ReadComp --> UI_Alert
    ReadComp --> UI_Loading

    UI_Button --> UI_SortButton
    UI_Modal --> UI_Input

    Browser -->|"reads/writes"| RTK
    RTK --> sliceList
    RTK --> sliceSchedule
    RTK --> hooks

    APIAI -->|"calls"| AIService
    AIService -->|"response"| APIAI

    %% Click Events
    click SSR_Layout "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/layout.tsx"
    click Home "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/page.tsx"
    click ListPage "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/list/page.tsx"
    click ReadPage "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/read/surah/[surahID]/page.tsx"
    click SchedulePage "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/schedule/page.tsx"
    click AIUIPage "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/ai/page.tsx"
    click DevPage "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/developers/page.tsx"
    click TermsPage "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/terms/page.tsx"
    click APIAI "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/api/ai/route.ts"
    click Navbar "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/Navbar/Navbar.tsx"
    click Sidebar "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/Sidebar/Sidebar.tsx"
    click Provider "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/Provider.tsx"
    click HomeComp "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/Home/Index.tsx"
    click ListComp "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/List/Index.tsx"
    click ScheduleComp "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/Schedule/Index.tsx"
    click ReadComp "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/ReadCom.tsx"
    click UI_Button "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/Button.tsx"
    click UI_Card "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/Card.tsx"
    click UI_Input "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/Input.tsx"
    click UI_Modal "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/Modal.tsx"
    click UI_SurahCard "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/SurahCard.tsx"
    click UI_ScheduleCard "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/ScheduleCard.tsx"
    click UI_Alert "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/Alert.tsx"
    click UI_Loading "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/Loading.tsx"
    click UI_SortButton "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/components/UI/SortButton.tsx"
    click RTK "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/rtk/store.ts"
    click hooks "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/rtk/hooks.ts"
    click sliceList "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/rtk/slices/listSlice.ts"
    click sliceSchedule "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/src/app/rtk/slices/scheduleSlice.ts"
    click StaticData "https://github.com/umerqureshi409/al-quran-kanzul-iman/tree/main/public/"
    click tailwind "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/tailwind.config.js"
    click postcss "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/postcss.config.js"
    click tsconfig "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/tsconfig.json"
    click env "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/.env.local"
    click pkg "https://github.com/umerqureshi409/al-quran-kanzul-iman/blob/main/package.json"

    %% Styling
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef api fill:#FFE4B3,stroke:#d97706,color:#92400e
    classDef state fill:#DFFFD0,stroke:#166534,color:#166534
    classDef data fill:#E0E0E0,stroke:#4b5563,color:#374151
    classDef external fill:#F3E8FF,stroke:#7e22ce,color:#5b21b6
```
