# nabilahzaid/sedekah-je architecture

> Architecture diagram of the GitHub repository nabilahzaid/sedekah-je, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nabilahzaid/sedekah-je
- Repository: https://github.com/nabilahzaid/sedekah-je

## Overview

##### Project type and purpose
- This is a Next.js-based, static content-driven web application (a “full-stack” front-end with no external server-side API).
- Purpose: Display a curated, searchable list of donation (QR) codes for mosques, suraus, and institutions.

##### File structure
- Top-level:
- app/            → Next.js App Router (layout.tsx, page.tsx, globals.css)
- components/     → React UI components (map, filters, cards, popovers, etc.)
- hooks/          → Custom React hooks (e.g., useOutsideClick)
- lib/            → Utility functions
- app/data/       → institutions.ts (static data source)
- app/types/      → TypeScript definitions
- config files    → next.config.mjs, tailwind.config.ts, postcss.config.mjs, tsconfig.json, ESLint/biome configs, package.json

##### README for additional insights
- Data is maintained in `app/data/institutions.ts`; contributors add entries here.
- Future scope includes an admin panel (Filament PHP), dynamic data extraction, and filtering by state.
- No existing back-end database—data is shipped at build time.

##### Main components and their interactions
a. Next.js App Router
- layout.tsx: global wrappers (fonts, headers, toasts)
- page.tsx: root page—renders filters, map, and institution list
b. Data Layer
- institutions.ts: static JSON-like data
- lib/utils.ts: helpers (e.g., search, filter functions)
c. UI Layer
- components/ui: building blocks (Button, Card, Dialog, Toast, etc.)
- components/sections: page sections (filters.tsx, states-dropdown.tsx)
- components/map.tsx: map rendering with marker and QR overlays
d. Static Assets
e. Styling & Config
- globals.css + Tailwind
- Sonner (toast notifications)

Interactions:
- On page load, Next.js reads `institutions.ts` → passes data into page.tsx
- page.tsx renders Sections and Map, wiring filter hook callbacks
- User input (filter dropdown, search) triggers state updates → filtered list + highlighted map markers
- Components invoke lib/utils and use-toast for side effects

##### Architectural patterns & design principles
- Component-based UI (React + Next.js) with separation by domain (ui vs. sections)
- Data-driven rendering: static data → hydration → client-side interactivity
- Single page root with client routing via Next.js, no custom server or API routes
- Future potential: a service layer (REST or GraphQL) for admin panel

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Core Application - Next.js App Router
    subgraph "Next.js App Router" 
        direction TB
        Layout["layout.tsx\n(global wrappers)"]:::core
        Page["page.tsx + data fetch"]:::core
        Styles["globals.css"]:::core
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Data["institutions.ts\n(static data)"]:::core
        Types["institutions.ts\n(type definitions)"]:::core
    end

    %% Shared Components & Utilities
    subgraph "Shared Components & Utilities"
        direction TB
        Utils["utils.ts\n(helpers)"]:::shared
        Hook["use-outside-click.tsx"]:::shared
        subgraph "UI Component Library"
            direction TB
            Button["button.tsx"]:::shared
            Card["card.tsx"]:::shared
            InstCard["institution-card.tsx"]:::shared
            QRDisplay["qrCodeDisplay.tsx"]:::shared
            SearchBar["searchbar.tsx"]:::shared
            Dialog["dialog.tsx"]:::shared
            Popover["popover.tsx"]:::shared
            Toast["toast.tsx"]:::shared
            Toaster["toaster.tsx"]:::shared
            UseToast["use-toast.ts"]:::shared
        end
        subgraph "Page Sections"
            direction TB
            Filters["filters.tsx"]:::shared
            StatesDropdown["states-dropdown.tsx"]:::shared
        end
        MapComp["map.tsx"]:::shared
    end

    %% Static Assets & Configuration
    subgraph "Static Assets"
        direction TB
        Icons["public/icons"]:::static
        MosqueImgs["public/masjid"]:::static
        SurauImgs["public/surau"]:::static
        OtherImgs["public/lain"]:::static
    end

    subgraph "Configuration & Manifests"
        direction TB
        NextConfig["next.config.mjs"]:::static
        TailwindConfig["tailwind.config.ts"]:::static
        PostCSS["postcss.config.mjs"]:::static
        PackageJSON["package.json"]:::static
        TSConfig["tsconfig.json"]:::static
    end

    %% Future Extension
    AdminPanel["Filament PHP Admin\n(DB)"]:::external
    AdminPanel -.->|future_sync| Data

    %% Data Flow Connections
    Data -->|imports| Page
    Types -->|imports| Page
    Page -->|renders| Filters
    Page -->|renders| StatesDropdown
    Page -->|renders| MapComp
    Filters -->|uses callback| Utils
    StatesDropdown -->|uses callback| Utils
    MapComp -->|overlays| QRDisplay
    MapComp -->|imports data| Data
    Page -->|passes data to| InstCard
    InstCard -->|calls| QRDisplay
    Button -->|used in| Filters
    SearchBar -->|used in| Filters
    Dialog -->|used for| instCard
    Popover -->|used in| Filters
    Toast -->|notifications| Page
    Toaster -->|providers| Page
    UseToast -->|wraps Sonner| Toast
    Hook -->|handles| Page

    %% User Interaction Flow
    UserInput["User Input"]:::external
    UserInput -->|triggers| Hook
    Hook -->|calls| Utils
    Utils -->|returns filtered data| Page
    Page -->|updates| MapComp
    Page -->|updates| InstCard

    %% Click Events
    click Layout "https://github.com/nabilahzaid/sedekah-je/blob/main/app/layout.tsx"
    click Page "https://github.com/nabilahzaid/sedekah-je/blob/main/app/page.tsx"
    click Styles "https://github.com/nabilahzaid/sedekah-je/blob/main/app/globals.css"
    click Data "https://github.com/nabilahzaid/sedekah-je/blob/main/app/data/institutions.ts"
    click Types "https://github.com/nabilahzaid/sedekah-je/blob/main/app/types/institutions.ts"
    click Utils "https://github.com/nabilahzaid/sedekah-je/blob/main/lib/utils.ts"
    click Hook "https://github.com/nabilahzaid/sedekah-je/blob/main/hooks/use-outside-click.tsx"
    click MapComp "https://github.com/nabilahzaid/sedekah-je/blob/main/components/map.tsx"
    click Filters "https://github.com/nabilahzaid/sedekah-je/blob/main/components/sections/filters.tsx"
    click StatesDropdown "https://github.com/nabilahzaid/sedekah-je/blob/main/components/states-dropdown.tsx"
    click Button "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/button.tsx"
    click Card "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/card.tsx"
    click InstCard "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/institution-card.tsx"
    click QRDisplay "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/qrCodeDisplay.tsx"
    click SearchBar "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/searchbar.tsx"
    click Dialog "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/dialog.tsx"
    click Popover "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/popover.tsx"
    click Toast "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/toast.tsx"
    click Toaster "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/toaster.tsx"
    click UseToast "https://github.com/nabilahzaid/sedekah-je/blob/main/components/ui/use-toast.ts"
    click Icons "https://github.com/nabilahzaid/sedekah-je/tree/main/public/icons"
    click MosqueImgs "https://github.com/nabilahzaid/sedekah-je/tree/main/public/masjid"
    click SurauImgs "https://github.com/nabilahzaid/sedekah-je/tree/main/public/surau"
    click OtherImgs "https://github.com/nabilahzaid/sedekah-je/tree/main/public/lain"
    click NextConfig "https://github.com/nabilahzaid/sedekah-je/blob/main/next.config.mjs"
    click TailwindConfig "https://github.com/nabilahzaid/sedekah-je/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/nabilahzaid/sedekah-je/blob/main/postcss.config.mjs"
    click PackageJSON "https://github.com/nabilahzaid/sedekah-je/blob/main/package.json"
    click TSConfig "https://github.com/nabilahzaid/sedekah-je/blob/main/tsconfig.json"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef shared fill:#90EE90,stroke:#333,stroke-width:1px
    classDef static fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#FFFACD,stroke-dasharray: 5 5,stroke:#333,stroke-width:1px
```
