# ahmedbm98/anasco architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedbm98/anasco
- Repository: https://github.com/ahmedbm98/anasco

## Overview

##### Project type and purpose
- This is a full-stack web application built with Next.js (React framework) and Tailwind CSS.
- It serves server-rendered and statically generated pages, pulling in local JSON data (`public/Data/programs.json`) and rendering a dashboard with reusable UI components.

##### File structure
- Top-level config files: `next.config.ts`, `tsconfig.json`, ESLint and PostCSS configs, `package.json`.
- `public/`: static assets (images in `img/` and data JSON in `Data/`).
- `src/app/`: Next.js App Router directory (file-based routing).
- `page.tsx`, `dashboard/page.tsx` → route entrypoints.
- `_components/` → shared React UI components (Header, Sidebar, KPISection, ProgramsTable, etc.).
- `layout.tsx` → root layout for all pages.
- `globals.css` → base CSS imports.
- No separate `backend` or `api` folder—Next.js handles server side as part of the same codebase.

##### Key insights from README
- Next.js app created via `create-next-app` using the App Router.
- Runs on Node.js server (SSR) or as a static export on Vercel.
- Uses `next/font` for optimized font loading.

##### Main components
a. Client (Browser)
b. Next.js Application Server
- App Router
- React Server Components & Client Components
- `layout.tsx` (global shell)
- Page routes (`/`, `/dashboard`)
- Data loader reading `programs.json` from `public/Data/`
c. Static Assets Server (public folder)
- Images (`public/img/`)
- JSON data (`programs.json`)
- CSS (`globals.css`, Tailwind styles)
d. Build & Deployment Platform (e.g., Vercel)

##### Relationships & Data Flow
- Browser → HTTP GET → Next.js server → Renders page (SSR or SSG)
- During rendering, Next.js imports data from `public/Data/programs.json` and passes it to components (ProgramsTable, KPISection, etc.)
- Next.js serves static assets directly from `public/` (images, JSON, CSS)
- User interactions (e.g., protected routes) handled client-side in React (ProtectedRoute component)

##### Architectural Patterns & Principles
- File-based routing with Next.js App Router
- Separation of concerns:
- Layout vs. page content vs. UI components
- Server Components vs. Client Components (React 18 paradigm)
- Static data serving for performance (SSG where applicable)
- Utility-first styling (Tailwind CSS)

- `layout.tsx` (global shell)
- Route handlers (`page.tsx`, `dashboard/page.tsx`)
- Data loader function reading `programs.json`
5. Browser → Next.js Router (HTTP GET) → Data loader → UI Components → Browser
6. Build: Node.js + Next.js build process → Output optimized JS/CSS.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["Browser (User)"]:::client
        subgraph "React Components"
            direction TB
            PR["ProtectedRoute"]:::client
            Header["Header"]:::client
            SideBar["SideBar"]:::client
            Notifications["Notifications"]:::client
            KPISection["KPISection"]:::client
            ProgramsTable["ProgramsTable"]:::client
            OrganizationInfo["OrganizationInfo"]:::client
            TrainingCard["TrainingCard"]:::client
        end
    end

    %% Server Layer
    subgraph "Server Layer"
        direction TB
        NextServer["Next.js App Server"]:::server
        subgraph "App Router"
            direction TB
            Layout["layout.tsx"]:::server
            HomeRoute["page.tsx (/)"]:::server
            DashboardRoute["dashboard/page.tsx"]:::server
            DataLoader["programs.json Loader"]:::server
        end
    end

    %% Static Assets
    subgraph "Static Assets (public/)" 
        direction TB
        JSONData["programs.json"]:::static
        Images["img/"]:::static
        GlobalCSS["globals.css"]:::static
    end

    %% Deployment Layer
    subgraph "Build & Deployment"
        direction TB
        Configs["Config Files"]:::deploy
        Vercel["Vercel CI/CD"]:::deploy
    end

    %% Config Files Breakdown
    subgraph Configs
        direction TB
        NextConfig["next.config.ts"]:::deploy
        TailwindConfig["tailwind.config.js"]:::deploy
        PostCSSConfig["postcss.config.js"]:::deploy
        TSConfig["tsconfig.json"]:::deploy
        ESLintConfig["eslint.config.mjs"]:::deploy
        PackageJSON["package.json"]:::deploy
    end

    %% Connections
    Browser -->|"HTTP GET"| NextServer
    NextServer -->|"Uses App Router"| Layout
    Layout --> HomeRoute
    Layout --> DashboardRoute
    HomeRoute --> DataLoader
    DashboardRoute --> DataLoader
    DataLoader --> JSONData
    NextServer --> JSONData
    NextServer --> Images
    NextServer --> GlobalCSS
    Browser --> PR
    PR -->|renders| Header
    PR --> SideBar
    PR --> Notifications
    PR --> KPISection
    PR --> ProgramsTable
    PR --> OrganizationInfo
    PR --> TrainingCard
    Vercel --> NextServer
    Vercel --> Configs

    %% Click Events
    click Layout "https://github.com/ahmedbm98/anasco/blob/main/src/app/layout.tsx"
    click HomeRoute "https://github.com/ahmedbm98/anasco/blob/main/src/app/page.tsx"
    click DashboardRoute "https://github.com/ahmedbm98/anasco/blob/main/src/app/dashboard/page.tsx"
    click PR "https://github.com/ahmedbm98/anasco/blob/main/src/app/_components/ProtectedRoute.tsx"
    click Header "https://github.com/ahmedbm98/anasco/blob/main/src/app/_components/Header.tsx"
    click SideBar "https://github.com/ahmedbm98/anasco/blob/main/src/app/_components/SideBar.tsx"
    click Notifications "https://github.com/ahmedbm98/anasco/blob/main/src/app/_components/Notifications.tsx"
    click KPISection "https://github.com/ahmedbm98/anasco/blob/main/src/app/_components/KPISection.tsx"
    click ProgramsTable "https://github.com/ahmedbm98/anasco/blob/main/src/app/_components/ProgramsTable.tsx"
    click OrganizationInfo "https://github.com/ahmedbm98/anasco/blob/main/src/app/_components/OrganizationInfo.tsx"
    click TrainingCard "https://github.com/ahmedbm98/anasco/blob/main/src/app/_components/TrainingCard.tsx"
    click GlobalCSS "https://github.com/ahmedbm98/anasco/blob/main/src/app/globals.css"
    click JSONData "https://github.com/ahmedbm98/anasco/blob/main/public/Data/programs.json"
    click Images "https://github.com/ahmedbm98/anasco/tree/main/public/img/"
    click NextConfig "https://github.com/ahmedbm98/anasco/blob/main/next.config.ts"
    click TailwindConfig "https://github.com/ahmedbm98/anasco/blob/main/tailwind.config.js"
    click PostCSSConfig "https://github.com/ahmedbm98/anasco/blob/main/postcss.config.js"
    click TSConfig "https://github.com/ahmedbm98/anasco/blob/main/tsconfig.json"
    click ESLintConfig "https://github.com/ahmedbm98/anasco/blob/main/eslint.config.mjs"
    click PackageJSON "https://github.com/ahmedbm98/anasco/blob/main/package.json"

    %% Styles
    classDef client fill:#add8e6,stroke:#000,stroke-width:1px
    classDef server fill:#90ee90,stroke:#000,stroke-width:1px
    classDef static fill:#ffa500,stroke:#000,stroke-width:1px
    classDef deploy fill:#d3d3d3,stroke:#000,stroke-width:1px
```
