# agrawal-harsh/sevasrot architecture

> Architecture diagram of the GitHub repository agrawal-harsh/sevasrot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/agrawal-harsh/sevasrot
- Repository: https://github.com/agrawal-harsh/sevasrot

## Overview

##### Main Components
- Frontend Pages: The “app” directory shows all the page-level components – for example, the homepage (app/page.tsx), donation page (app/donate/page.tsx), awareness page, volunteer (become-sevak) page, transparency page, and an impact page.
- Layout and Shared UI: The “app/layout.tsx” sets up the overall layout (which includes header, footer, and common styles from “globals.css”). The components folder contains reusable UI elements such as header, footer, language and theme providers/ toggles, cookie consent, and various feature components like donation forms, donation certificates, sliders, counters, testimonials, and more.
- Component Library: The project makes extensive use of shadcn/ui components (and even extends these inside components/ui) to create a consistent UI. These components incorporate interactive elements (accordions, alerts, dialogs, carousels, etc.) that are used throughout the site.
- Utility and Hooks: The “hooks” and “lib” directories provide custom hooks (e.g., use-mobile, use-toast) and general-purpose utilities.
- Styling & Configuration: Tailwind CSS (customized via tailwind.config.ts) and Next.js configuration (next.config.mjs) indicate modern styling and build setups.

##### Relationships and Interactions
- Routing: In a Next.js App Router structure, each folder under “app” represents a distinct route. The main pages interact with multiple shared components, for example:
- The header and footer (common across pages) interact with global contexts (language and theme providers).
- The donation page utilizes the DonationForm, DonationCertificate, DonationCounter, and DonationImpactSlider components.
- The volunteer page (become-sevak) integrates with the SevakRegistrationForm and possibly additional volunteer-related displays (like SevakShowcase).
- Data Flow: While the project currently simulates data (using mock data), the README hints at future backend integration. This means that form submissions (DonationForm and SevakRegistrationForm) are handled client-side (using React Hook Form with Zod validation), but are conceptually designed to send data to some API endpoint.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: The project emphasizes reusability by splitting elements into small, focused components.
- Separation of Concerns: Page-level routing, layout management, and individual UI functionality (like theming, internationalization, and forms) are separated into different modules/directories.
- Client/Server Component Strategy: Employing Next.js, the application leverages server-side rendering for static content while using client components for interactive elements (e.g., form handling, theme toggles) for improved performance.

- Next.js’s routing and page components in the next layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layer 1: Client Browser
    subgraph "Client Browser"
        Browser("User Browser"):::browser
    end

    %% Layer 2: Next.js Pages
    subgraph "Next.js Pages"
        HomePage("Home Page"):::page
        DonatePage("Donation Page"):::page
        AwarenessPage("Awareness Page"):::page
        VolunteerPage("Volunteer Page"):::page
        ImpactPage("Impact Page"):::page
        TransparencyPage("Transparency Page"):::page
    end

    %% Layer 3: Layout and Shared UI
    subgraph "Layout and Shared UI"
        Layout("Overall Layout"):::layout
        GlobalStylesApp("Global Styles (app)"):::layout
        GlobalStylesStyles("Global Styles (styles)"):::layout
        Header("Header Component"):::layout
        Footer("Footer Component"):::layout
        CookieConsent("Cookie Consent"):::layout
        LanguageProvider("Language Provider"):::layout
        LanguageSwitcher("Language Switcher"):::layout
        ThemeProvider("Theme Provider"):::layout
        ThemeToggle("Theme Toggle"):::layout
        Toaster("Toaster"):::layout
    end

    %% Layer 4: Component Library
    subgraph "Component Library"
        ShadcnUI("Shadcn UI Components"):::ui
    end

    %% Layer 5: Feature Components
    subgraph "Feature Components"
        subgraph "Donation Features"
            DonationForm("Donation Form"):::feature
            DonationCertificate("Donation Certificate"):::feature
            DonationCounter("Donation Counter"):::feature
            DonationImpactSlider("Donation Impact Slider"):::feature
        end
        subgraph "Volunteer Features"
            SevakRegistrationForm("Sevak Registration Form"):::feature
            SevakShowcase("Sevak Showcase"):::feature
        end
        subgraph "Additional UI Elements"
            TestimonialSection("Testimonial Section"):::feature
            NewsSection("News Section"):::feature
            EmergencyFund("Emergency Fund"):::feature
        end
    end

    %% Layer 6: Utilities & Hooks
    subgraph "Utilities & Hooks"
        useMobileHook("use-mobile Hook (hooks)"):::hook
        useMobileUI("use-mobile Hook (ui)"):::hook
        useToast("use-toast Hook"):::hook
        Utils("Utility Functions"):::hook
    end

    %% Layer 7: Styling & Configuration
    subgraph "Styling & Configuration"
        TailwindConfig("Tailwind CSS Config"):::config
        NextConfig("Next.js Config"):::config
        PostCSSConfig("PostCSS Config"):::config
    end

    %% Future Backend API (Not yet integrated)
    BackendAPI("Backend API (Future)"):::backend

    %%----------------- Relationships -----------------%%

    %% Browser to Pages
    Browser --> HomePage
    Browser --> DonatePage
    Browser --> AwarenessPage
    Browser --> VolunteerPage
    Browser --> ImpactPage
    Browser --> TransparencyPage

    %% Pages use Overall Layout
    HomePage --> Layout
    DonatePage --> Layout
    AwarenessPage --> Layout
    VolunteerPage --> Layout
    ImpactPage --> Layout
    TransparencyPage --> Layout

    %% Layout integrates Shared UI components
    Layout --> Header
    Layout --> Footer
    Layout --> CookieConsent
    Layout --> LanguageProvider
    Layout --> ThemeProvider
    Layout --> Toaster
    Layout --> GlobalStylesApp
    Layout --> GlobalStylesStyles

    %% Language and Theme Providers manage their respective switches/toggles
    LanguageProvider --> LanguageSwitcher
    ThemeProvider --> ThemeToggle

    %% Layout utilizes Component Library for UI elements
    ShadcnUI --> Header
    ShadcnUI --> DonationForm
    ShadcnUI --> SevakRegistrationForm

    %% Donation Page interacts with Donation Features
    DonatePage --> DonationForm
    DonatePage --> DonationCertificate
    DonatePage --> DonationCounter
    DonatePage --> DonationImpactSlider

    %% Volunteer Page interacts with Volunteer Features
    VolunteerPage --> SevakRegistrationForm
    VolunteerPage --> SevakShowcase

    %% Layout also displays additional UI elements
    Layout --> TestimonialSection
    Layout --> NewsSection
    Layout --> EmergencyFund

    %% Utilities and Hooks support Layout and Feature Components
    Layout --> useMobileHook
    DonatePage --> useMobileUI
    Layout --> useToast
    DonationForm --> useToast
    SevakRegistrationForm --> useToast
    Layout --> Utils

    %% Layout is configured by Styling & Configuration
    Layout --> TailwindConfig
    Layout --> NextConfig
    Layout --> PostCSSConfig

    %% Feature Components conceptually send data to Future Backend API (dashed connections)
    DonationForm -.-> BackendAPI
    DonationCertificate -.-> BackendAPI
    DonationCounter -.-> BackendAPI
    DonationImpactSlider -.-> BackendAPI
    SevakRegistrationForm -.-> BackendAPI
    SevakShowcase -.-> BackendAPI
    TestimonialSection -.-> BackendAPI
    NewsSection -.-> BackendAPI
    EmergencyFund -.-> BackendAPI

    %%----------------- Click Events -----------------%%
    click HomePage "https://github.com/agrawal-harsh/sevasrot/blob/main/app/page.tsx"
    click DonatePage "https://github.com/agrawal-harsh/sevasrot/blob/main/app/donate/page.tsx"
    click AwarenessPage "https://github.com/agrawal-harsh/sevasrot/blob/main/app/awareness/page.tsx"
    click VolunteerPage "https://github.com/agrawal-harsh/sevasrot/blob/main/app/become-sevak/page.tsx"
    click ImpactPage "https://github.com/agrawal-harsh/sevasrot/blob/main/app/impact/page.tsx"
    click TransparencyPage "https://github.com/agrawal-harsh/sevasrot/blob/main/app/transparency/page.tsx"
    click Layout "https://github.com/agrawal-harsh/sevasrot/blob/main/app/layout.tsx"
    click GlobalStylesApp "https://github.com/agrawal-harsh/sevasrot/blob/main/app/globals.css"
    click GlobalStylesStyles "https://github.com/agrawal-harsh/sevasrot/blob/main/styles/globals.css"
    click Header "https://github.com/agrawal-harsh/sevasrot/blob/main/components/header.tsx"
    click Footer "https://github.com/agrawal-harsh/sevasrot/blob/main/components/footer.tsx"
    click CookieConsent "https://github.com/agrawal-harsh/sevasrot/blob/main/components/cookie-consent.tsx"
    click LanguageProvider "https://github.com/agrawal-harsh/sevasrot/blob/main/components/language-provider.tsx"
    click LanguageSwitcher "https://github.com/agrawal-harsh/sevasrot/blob/main/components/language-switcher.tsx"
    click ThemeProvider "https://github.com/agrawal-harsh/sevasrot/blob/main/components/theme-provider.tsx"
    click ThemeToggle "https://github.com/agrawal-harsh/sevasrot/blob/main/components/theme-toggle.tsx"
    click Toaster "https://github.com/agrawal-harsh/sevasrot/blob/main/components/toaster.tsx"
    click ShadcnUI "https://github.com/agrawal-harsh/sevasrot/tree/main/components/ui/"
    click DonationForm "https://github.com/agrawal-harsh/sevasrot/blob/main/components/donation-form.tsx"
    click DonationCertificate "https://github.com/agrawal-harsh/sevasrot/blob/main/components/donation-certificate.tsx"
    click DonationCounter "https://github.com/agrawal-harsh/sevasrot/blob/main/components/donation-counter.tsx"
    click DonationImpactSlider "https://github.com/agrawal-harsh/sevasrot/blob/main/components/donation-impact-slider.tsx"
    click SevakRegistrationForm "https://github.com/agrawal-harsh/sevasrot/blob/main/components/sevak-registration-form.tsx"
    click SevakShowcase "https://github.com/agrawal-harsh/sevasrot/blob/main/components/sevak-showcase.tsx"
    click TestimonialSection "https://github.com/agrawal-harsh/sevasrot/blob/main/components/testimonial-section.tsx"
    click NewsSection "https://github.com/agrawal-harsh/sevasrot/blob/main/components/news-section.tsx"
    click EmergencyFund "https://github.com/agrawal-harsh/sevasrot/blob/main/components/emergency-fund.tsx"
    click useMobileHook "https://github.com/agrawal-harsh/sevasrot/blob/main/hooks/use-mobile.tsx"
    click useMobileUI "https://github.com/agrawal-harsh/sevasrot/blob/main/components/ui/use-mobile.tsx"
    click useToast "https://github.com/agrawal-harsh/sevasrot/blob/main/hooks/use-toast.ts"
    click Utils "https://github.com/agrawal-harsh/sevasrot/blob/main/lib/utils.ts"
    click TailwindConfig "https://github.com/agrawal-harsh/sevasrot/blob/main/tailwind.config.ts"
    click NextConfig "https://github.com/agrawal-harsh/sevasrot/blob/main/next.config.mjs"
    click PostCSSConfig "https://github.com/agrawal-harsh/sevasrot/blob/main/postcss.config.mjs"

    %%----------------- Styling -----------------%%
    classDef browser fill:#D6EAF8,stroke:#3498DB,stroke-width:2px;
    classDef page fill:#A9CCE3,stroke:#2874A6,stroke-width:2px;
    classDef layout fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef ui fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
    classDef feature fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef hook fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef config fill:#FDEBD0,stroke:#CA6F1E,stroke-width:2px;
    classDef backend fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
```
