# galsendev221/website architecture

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

- Interactive diagram: https://gitdiagram.com/galsendev221/website
- Repository: https://github.com/galsendev221/website

## Overview

##### Project Type & Purpose
- This is a full-stack (mostly frontend) web application built on Next.js with Tailwind CSS for styling.
- It serves static and dynamic pages (home, about, events, gallery, legal, error pages) and provides a minimal backend via Next.js API routes for event data.

##### Main Architectural Components
a. Client Browser
- Sends HTTP(S) requests; renders HTML/CSS/JS.
b. Next.js Server (SSR/SSG)
- Renders pages server-side or at build time.
- Hosts pages (src/pages) and API routes (src/pages/api).
c. Data Layer
- Static JSON or TypeScript modules under src/pages/api/events (data.ts, type.ts).
d. UI Components Library
- Reusable React components in src/components (layout, navbar, footer, sections).
e. Styling Engine
- Tailwind CSS config (tailwind.config.cjs) + PostCSS (postcss.config.cjs).
f. Localization Module
- JSON files under locales/{en,fr} and i18n.json drive multi-language support.
g. Build & CI/CD
- GitHub Actions (.github/workflows/test.yml), Husky hooks, ESLint, Prettier, lint-staged.
h. Static Assets

##### Relationships & Data Flow
- Browser → Next.js Server: requests for pages or API endpoints.
- Next.js Server
– ∙ Pages → uses getStaticProps/getServerSideProps to fetch from Data Layer.
– ∙ API Routes → serve JSON from Data Layer to client or SSR functions.
- Next.js → serves rendered HTML + bundled JS/CSS to Browser.
- UI Components consume props/data and render markup.
- Styling Engine processes Tailwind classes into CSS.
- Localization Module supplies text resources to pages/components.
- CI/CD pipeline builds, lints, tests, and deploys to hosting (e.g., Vercel).

##### Architectural Patterns & Design Principles
- Component-based UI (React) with clear separation of concerns.
- File-system-based routing (Next.js).
- Mix of Static-Site Generation (SSG) and Server-Side Rendering (SSR).
- API layer co-located with frontend for light backend needs.
- Localization separated into external JSON files.
- CI/CD enforces code quality and automates deploy.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    subgraph "Client"
        Browser["Browser<br/>(HTTP/S Requests)"]:::frontend
    end

    %% Server Application
    subgraph "Server App"
        NextServer["Next.js Server<br/>(SSR/SSG)"]:::backend

        subgraph "Pages"
            Pages["src/pages"]:::frontend
        end
        subgraph "API Routes"
            APIRoutes["src/pages/api"]:::backend
            EventAPI["[slug] API Handler"]:::backend
        end

        UIComp["UI Components<br/>(src/components)"]:::frontend
        Layout["Layout.tsx"]:::frontend
        Nav["Navbar, MobileMenu, Header, Footer"]:::frontend
        Gallery["EventsGallery.tsx"]:::frontend
        ErrorComp["404Error.tsx<br/>500Error.tsx"]:::frontend
        Legal["LegalPolicy, LegalPrivacy, LegalTerms"]:::frontend
        SVGComp["GalsenDevLogo.tsx<br/>transform-icon.ts"]:::frontend
        Utils["cn.ts"]:::frontend
        Styles["globals.css"]:::frontend
        Tailwind["Tailwind CSS<br/>(tailwind.config.cjs)"]:::backend
        PostCSS["PostCSS<br/>(postcss.config.cjs)"]:::backend
        I18nConfig["i18n.json"]:::backend
        Locales["locales/en/*.json<br/>locales/fr/*.json"]:::backend
    end

    %% Data & Assets
    subgraph "Data & Assets"
        DataLayer["data.ts<br/>type.ts"]:::data
        Assets["Static Assets<br/>(favicon, icons, img, svg)"]:::asset
    end

    %% DevTooling & CI/CD
    subgraph "DevTooling & CI/CD"
        CI["GitHub Actions<br/>(test.yml)"]:::cicd
        Husky["Husky Hooks<br/>(pre-commit)"]:::cicd
        Lint["ESLint, lint-staged, Prettier"]:::cicd
    end

    %% Connections
    Browser -->|"requests pages/API"| NextServer
    NextServer -->|"serves rendered pages"| Browser
    NextServer -->|"fetches data"| DataLayer
    NextServer -->|"serves API responses"| Browser
    NextServer --> UIComp
    UIComp --> Styles
    UIComp --> I18nConfig
    UIComp --> Locales
    NextServer --> Tailwind
    NextServer --> PostCSS
    CI --> NextServer
    CI --> Tailwind
    CI --> PostCSS
    CI --> Lint
    CI --> Husky

    %% Click Events
    click Pages "https://github.com/galsendev221/website/tree/production/src/pages"
    click APIRoutes "https://github.com/galsendev221/website/tree/production/src/pages/api"
    click EventAPI "https://github.com/galsendev221/website/blob/production/src/pages/api/events/[slug]/index.ts"
    click DataLayer "https://github.com/galsendev221/website/blob/production/src/pages/api/events/data.ts"
    click DataLayer "https://github.com/galsendev221/website/blob/production/src/pages/api/events/type.ts"
    click UIComp "https://github.com/galsendev221/website/tree/production/src/components"
    click Layout "https://github.com/galsendev221/website/blob/production/src/components/Layout.tsx"
    click Nav "https://github.com/galsendev221/website/blob/production/src/components/Navbar.tsx"
    click Nav "https://github.com/galsendev221/website/blob/production/src/components/MobileMenu.tsx"
    click Nav "https://github.com/galsendev221/website/blob/production/src/components/Header.tsx"
    click Nav "https://github.com/galsendev221/website/blob/production/src/components/Footer.tsx"
    click Gallery "https://github.com/galsendev221/website/blob/production/src/components/gallery/EventsGallery.tsx"
    click ErrorComp "https://github.com/galsendev221/website/blob/production/src/components/errors/404Error.tsx"
    click ErrorComp "https://github.com/galsendev221/website/blob/production/src/components/errors/500Error.tsx"
    click Legal "https://github.com/galsendev221/website/blob/production/src/components/legal/LegalPolicy.tsx"
    click Legal "https://github.com/galsendev221/website/blob/production/src/components/legal/LegalPrivacy.tsx"
    click Legal "https://github.com/galsendev221/website/blob/production/src/components/legal/LegalTerms.tsx"
    click SVGComp "https://github.com/galsendev221/website/blob/production/src/components/svg/GalsenDevLogo.tsx"
    click SVGComp "https://github.com/galsendev221/website/blob/production/other/transform-icon.ts"
    click Utils "https://github.com/galsendev221/website/blob/production/utils/cn.ts"
    click Styles "https://github.com/galsendev221/website/blob/production/src/styles/globals.css"
    click Tailwind "https://github.com/galsendev221/website/blob/production/tailwind.config.cjs"
    click PostCSS "https://github.com/galsendev221/website/blob/production/postcss.config.cjs"
    click I18nConfig "https://github.com/galsendev221/website/blob/production/i18n.json"
    click Locales "https://github.com/galsendev221/website/blob/production/locales/en/*.json"
    click Locales "https://github.com/galsendev221/website/blob/production/locales/fr/*.json"
    click CI "https://github.com/galsendev221/website/blob/production/.github/workflows/test.yml"
    click Husky "https://github.com/galsendev221/website/tree/production/.husky/pre-commit"
    click Lint "https://github.com/galsendev221/website/blob/production/.eslintrc.json"
    click Lint "https://github.com/galsendev221/website/blob/production/.lintstagedrc.cjs"
    click Lint "https://github.com/galsendev221/website/blob/production/.prettierrc.json"

    %% Styles
    classDef frontend fill:#D6E4FF,stroke:#0066CC
    classDef backend fill:#DFF7DF,stroke:#1A7F37
    classDef data fill:#FFF4D6,stroke:#CC9A00
    classDef asset fill:#F0F0F0,stroke:#999999
    classDef cicd fill:#FFE6E6,stroke:#CC0000
```
