# cpps-unesp/site-cpps architecture

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

- Interactive diagram: https://gitdiagram.com/cpps-unesp/site-cpps
- Repository: https://github.com/cpps-unesp/site-cpps

## Overview

##### Project type and purpose
- This is a JAMstack‐style, static website for an academic research center.
- Built with Astro (SSG), TypeScript, Tailwind CSS + DaisyUI, MDX for content, Pagefind for client-side search, and GitHub Actions for CI/CD.

##### File structure
- Top-level “src/” holds the UI code and content:
- components/ (Astro UI components)
- content/ (MDX files for docs, team members, news)
- i18n/ (locales JSON + route translations)
- layouts/ (page templates)
- pages/ (Astro page entry points by language)
- public/ holds static assets (images, scripts).
- Config files: astro.config.mjs, tailwind.config.js, tsconfig.json.
- CI/CD: .github/workflows/deploy.yml.

##### Extract architecture notes from README
- Content pipeline: MDX → Astro → static HTML/CSS/JS.
- Internationalization (3 locales) integrated at routing and content level.
- Client search via Pagefind (build-time indexing + client library).
- Theming handled by DaisyUI + custom themeSwitcher.js.
- Deployment yields a “dist/” folder of pure static assets.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer & Code Repository
    Dev["Developer"]:::dev
    Repo["GitHub Repository\n(code, MDX, configs)"]:::dev

    Dev -->|"Push code"| Repo
    Repo -->|"Triggers"| CI

    %% CI/CD Pipeline
    CI["GitHub Actions CI/CD Pipeline"]:::dev
    click CI "https://github.com/cpps-unesp/site-cpps/blob/main/.github/workflows/deploy.yml"

    CI -->|"Runs Build"| BuildEngine

    %% Build Engine
    subgraph "Astro Build Engine" 
        direction TB
        BE_Config["astro.config.mjs"]:::dev
        click BE_Config "https://github.com/cpps-unesp/site-cpps/blob/main/astro.config.mjs"
        MDX["MDX Source Files"]:::dev
        click MDX "https://github.com/cpps-unesp/site-cpps/tree/main/src/content/"
        I18nLocales["Locale Definitions"]:::dev
        click I18nLocales "https://github.com/cpps-unesp/site-cpps/blob/main/src/i18n/locales/{en.json,es.json,pt.json}"
        RouteTrans["Route Translations"]:::dev
        click RouteTrans "https://github.com/cpps-unesp/site-cpps/blob/main/src/i18n/routeTranslations.ts"
        Routes["Routes Definitions"]:::dev
        click Routes "https://github.com/cpps-unesp/site-cpps/blob/main/src/i18n/routes.ts"
        Pages["Astro Page Entry Points"]:::dev
        click Pages "https://github.com/cpps-unesp/site-cpps/tree/main/src/pages/[lang]/"
        Layouts["BaseLayout.astro"]:::dev
        click Layouts "https://github.com/cpps-unesp/site-cpps/blob/main/src/layouts/BaseLayout.astro"
        Components["Astro UI Components"]:::dev
        click Components "https://github.com/cpps-unesp/site-cpps/tree/main/src/components/"
        SearchModal["Search Modal Component"]:::dev
        click SearchModal "https://github.com/cpps-unesp/site-cpps/blob/main/src/components/SearchModal.astro"
        Pagefind["Pagefind Indexing (plugin)"]:::dev
        %% Pagefind integration in astro.config.mjs
        TailwindCfg["Tailwind CSS Configuration"]:::dev
        click TailwindCfg "https://github.com/cpps-unesp/site-cpps/blob/main/tailwind.config.js"
        TSConfig["TypeScript Configuration"]:::dev
        click TSConfig "https://github.com/cpps-unesp/site-cpps/blob/main/tsconfig.json"
        GlobalStyles["Global Styles"]:::dev
        click GlobalStyles "https://github.com/cpps-unesp/site-cpps/blob/main/src/styles/global.css"
        Utils["Utility Functions"]:::dev
        click Utils "https://github.com/cpps-unesp/site-cpps/blob/main/src/utils/{slug.ts,ordenar.js,getLangFromUrl.js}"
        Types["Type Definitions"]:::dev
        click Types "https://github.com/cpps-unesp/site-cpps/blob/main/src/types/lang.ts"
        Sitemap["Sitemap Generation"]:::dev
        click Sitemap "https://github.com/cpps-unesp/site-cpps/blob/main/src/pages/sitemap.xml.ts"
        Assets["Static Assets"]:::dev
        click Assets "https://github.com/cpps-unesp/site-cpps/tree/main/public/imagens/"
    end

    CI -->|"Builds with Astro"| BE_Config
    BE_Config --> MDX
    BE_Config --> I18nLocales
    BE_Config --> RouteTrans
    BE_Config --> Routes
    BE_Config --> Pages
    BE_Config --> Layouts
    BE_Config --> Components
    BE_Config --> Pagefind
    BE_Config --> TailwindCfg
    BE_Config --> TSConfig
    BE_Config --> GlobalStyles
    BE_Config --> Utils
    BE_Config --> Types
    BE_Config --> Sitemap
    BE_Config --> Assets

    BE_Config -->|"Outputs"| Dist

    %% Build Artifact
    Dist["dist/ (Static Assets)"]:::artifact

    CI -->|"Deploys"| Hosting["Static Hosting / CDN"]:::artifact

    %% Hosting & Delivery
    Hosting -->|"Serves"| Browser

    %% Runtime Browser
    subgraph "End-User Browser" 
        direction TB
        Browser["Browser (HTML/CSS/JS)"]:::runtime
        ThemeSwitch["themeSwitcher.js"]:::runtime
        SearchUI["Search Modal"]:::runtime
        I18nRuntime["i18n Routing"]:::runtime
    end

    Browser -->|"Loads"| ThemeSwitch
    Browser -->|"Loads"| SearchUI
    Browser -->|"Handles"| I18nRuntime

    %% Styles
    classDef dev fill:#AED6F1,stroke:#2980B9,color:#1B2631
    classDef artifact fill:#ABEBC6,stroke:#27AE60,color:#1B2631
    classDef runtime fill:#F9E79F,stroke:#B7950B,color:#1B2631
```
