# omarzaf/daadras architecture

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

- Interactive diagram: https://gitdiagram.com/omarzaf/daadras
- Repository: https://github.com/omarzaf/daadras

## Overview

##### Project Type & Purpose
- This is a Next.js project, bootstrapped with create-next-app. It is a modern React-based full-stack (server and client) web application that focuses on rendering pages (using the new app directory structure) and component-driven UI.
- The README highlights that it is primarily for building and deploying dynamic web pages, with built-in font optimizations and server-side rendering capabilities provided by Next.js.

##### Analyzing the File Structure
- Top-level files like package.json, next.config.mjs, and tsconfig.json indicate the configuration for a JavaScript/TypeScript Next.js project.
- The project is organized into a “src” directory that houses most of the application logic. Under “src/app”, you have subdirectories for different pages (about, contact, donate, what-we-do) and a set of shared components that are clearly structured.
- There is a “public” folder for static assets. The “src/components” directory holds reusable components (charts, headers, footers, etc.). This modular structure is key in identifying the separation of concerns.
- Additionally, folders like “src/theme” suggest global theming and styling, while nested directories under specific pages (e.g., 'about/components', 'donate/components') indicate that some components are page-specific.

a. Core Frontend Application – Represent the overall Next.js application layer.
- The “src/app” folder: Each subdirectory (about, contact, donate, what-we-do, etc.) should be represented to show that they handle separate routes/pages.
- The main layout and providers (e.g., layout.tsx, providers.tsx) form the basis of the app’s shared UI and state management.
b. Reusable UI Components – Represent the shared components from “src/components”.
c. Theming and Global Styles – Show that “src/theme” and “src/app/globals.css” provide consistent design elements.

##### Relationships and Interactions
- Global providers encompassing the entire app that supplies context or theme settings to all child components.
- Static asset usage by connecting the “public” folder to the UI components which reference these assets.
- Build or configuration dependencies (like next.config.mjs and tsconfig.json) towards the framework, although these are more on the infrastructure side.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: The project leverages React’s component model, dividing the application into reusable, self-contained components.
- Routing & Layout: The Next.js app directory structure embodies the file-based routing system, and shared layout components encapsulate common UI elements.
- Theming and Styling: The centralized "theme" and global CSS underscore the importance of consistent UI styling across the application.
- Separation of Concerns: By segregating page-specific components (in src/app/*) from reusable UI elements (in src/components), the design cleanly separates page routing from component logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Next.js Framework Layer
    NF["Next.js Framework"]:::framework
    VERCEL["Vercel Deployment"]:::platform

    %% Application Layer
    subgraph "Application Layer"
        %% Core Frontend Application (Routing & Page Components)
        subgraph "Core Frontend (Pages)"
            CA["Core App (Routing & Page Components)"]:::core
            ABOUT["About Page"]:::page
            CONTACT["Contact Page"]:::page
            DONATE["Donate Page"]:::page
            WHATWEDO["What We Do Page"]:::page
            HOME["Home Components"]:::page
            FONTS["Fonts"]:::page
        end

        %% Layout & Global Providers
        subgraph "Layout & Providers"
            LAYOUT["Layout (layout.tsx)"]:::provider
            PROVIDERS["Providers (providers.tsx)"]:::provider
        end

        %% Reusable UI Components
        subgraph "Reusable Components"
            COMPONENTS["Reusable UI Components"]:::component
            HEADER["Header"]:::componentChild
            FOOTER["Footer"]:::componentChild
            DAUGNUT["DaugnutChart"]:::componentChild
            PIE["PieChart"]:::componentChild
            DONATIONS["Donations Spend"]:::componentChild
            FOOTER_LOGO["Footer Logo"]:::componentChild
            HEADER_LOGO["Header Logo"]:::componentChild
            FOUNDATION["Foundation Facts"]:::componentChild
            OUR_TEAM["Our Team"]:::componentChild
            RADIO["Radio Options"]:::componentChild
        end

        %% Theming & Global Styles
        subgraph "Theming & Global Styles"
            THEME["Theme"]:::theme
            GLOBALS["Global Styles"]:::theme
        end

        %% Static Assets
        subgraph "Static Assets"
            ASSETS["Static Assets"]:::assets
        end
    end

    %% Relationships
    NF -->|"bootstraps"| CA
    NF -->|"deploys to"| VERCEL
    CA -->|"includes"| ABOUT
    CA -->|"includes"| CONTACT
    CA -->|"includes"| DONATE
    CA -->|"includes"| WHATWEDO
    CA -->|"includes"| HOME
    CA -->|"includes"| FONTS
    CA -->|"integrates"| LAYOUT
    LAYOUT -->|"complements with"| PROVIDERS
    LAYOUT -->|"renders"| COMPONENTS
    PROVIDERS -->|"provides data to"| COMPONENTS
    THEME -->|"applied to"| LAYOUT
    GLOBALS -->|"applied to"| LAYOUT
    COMPONENTS -->|"uses"| ASSETS

    %% Click Events
    click CA "https://github.com/omarzaf/daadras/tree/main/src/app"
    click LAYOUT "https://github.com/omarzaf/daadras/blob/main/src/app/layout.tsx"
    click PROVIDERS "https://github.com/omarzaf/daadras/blob/main/src/app/providers.tsx"
    click COMPONENTS "https://github.com/omarzaf/daadras/tree/main/src/components"
    click THEME "https://github.com/omarzaf/daadras/tree/main/src/theme"
    click GLOBALS "https://github.com/omarzaf/daadras/blob/main/src/app/globals.css"
    click ASSETS "https://github.com/omarzaf/daadras/tree/main/public"

    %% Styles
    classDef framework fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef platform fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef core fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef page fill:#FCF3CF,stroke:#B9770E,stroke-width:2px;
    classDef provider fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef component fill:#FADBD8,stroke:#943126,stroke-width:2px;
    classDef componentChild fill:#FDEDEC,stroke:#C0392B,stroke-width:2px;
    classDef theme fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;
    classDef assets fill:#D5F5E3,stroke:#239B56,stroke-width:2px;
```
