# pacodiz02/pi architecture

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

- Interactive diagram: https://gitdiagram.com/pacodiz02/pi
- Repository: https://github.com/pacodiz02/pi

## Overview

##### Project type and purpose
- This is a repository of service configuration files and static‐site demos.
- The “PRE” and “PRO” directories hold web server configs for pre-production and production.
- The “client-config” directory holds a JSON configuration delivered to clients.
- The “demos” directory contains two example static website builds (“demo1” and “demo2”), each with two variants:
- web-estatico (asset pipeline + SCSS, JS, mail handlers)
- web-html (pure HTML pages)

##### File structure
- Top-level directories:
- PRE/ (pre-prod web.conf)
- PRO/ (prod web-pdu.conf)
- client-config/ (config.json)
- demos/
- Each demo under demos/ has two variants:
– web-estatico: uses SCSS build, JS libs, mail scripts
– web-html: simple HTML pages
- No dynamic backend or database—purely static content served by web servers.
- Configuration files drive the behavior of the web servers in each environment.

##### Key insights from README
- It’s a lightweight toolkit: service configuration + static demos.

##### Main components
a. Configuration Repository
- Holds PRE/web.conf, PRO/web-pdu.conf, client-config/config.json, demos/
b. CI/CD Pipeline (optional)
- Checkout → Validate configs → Build SCSS/JS → Deploy to PRE → Smoke tests → Deploy to PRO
c. Environments
1) PRE-Environment
– Web Server (e.g., Nginx/Apache)
– Loads PRE/web.conf
– Serves demo1 & demo2
2) PRO-Environment
– Web Server
– Loads PRO/web-pdu.conf
– Serves same demos (or a subset) to end users
d. Clients
- Browsers request demo sites and fetch client-config/config.json as needed
e. Static Assets & Build Tools

##### Relationships & interactions
- Developers push to config repo → triggers CI/CD
- CI/CD deploys configs and static assets to PRE
- After validation, CI/CD propagates to PRO
- End users’ browsers
- GET / (demo home)
- GET /client-config/config.json
- GET CSS/JS assets under /web-estatico
- Optional POST to /mail/contact.php

##### Architectural patterns & principles
- Environment segregation (PRE vs. PRO)
- Immutable static assets (built once, deployed to both envs)
- Single source of truth for configs in version control
- Clear separation: configuration files vs. demo content

- Config repo vs. build pipeline vs. environments vs. clients

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration Repository
    ConfigRepo["Configuration Repository\n(README.md, PRE/, PRO/, client-config/, demos/)"]:::configRepo
    click ConfigRepo "https://github.com/pacodiz02/pi/blob/main/."

    %% CI/CD Pipeline
    CICD["CI/CD Pipeline\n(Checkout → Validate → Build → Deploy)"]:::pipeline

    %% Pre-production Environment
    subgraph "PRE Environment" 
        direction TB
        PRE_Server["Web Server\n(Nginx/Apache)"]:::env
        PRE_Config["PRE/web.conf"]:::env
        click PRE_Config "https://github.com/pacodiz02/pi/blob/main/PRE/web.conf"
        
        subgraph "Demo1"
            direction TB
            subgraph "Web-Estático" 
                direction TB
                D1E_SCSS["SCSS Source"]:::build
                click D1E_SCSS "https://github.com/pacodiz02/pi/tree/main/demos/demo1/web-estatico/scss/"
                D1E_CSS["Built CSS\n(style.css)"]:::build
                click D1E_CSS "https://github.com/pacodiz02/pi/blob/main/demos/demo1/web-estatico/css/style.css"
                D1E_JS["Built JS\n(main.js)"]:::build
                click D1E_JS "https://github.com/pacodiz02/pi/blob/main/demos/demo1/web-estatico/js/main.js"
                D1E_Lib["3rd-Party Libs"]:::build
                click D1E_Lib "https://github.com/pacodiz02/pi/tree/main/demos/demo1/web-estatico/lib/"
                D1E_MailJS["Mail Handler JS"]:::build
                click D1E_MailJS "https://github.com/pacodiz02/pi/blob/main/demos/demo1/web-estatico/mail/contact.js"
                D1E_MailPHP["Mail Handler PHP"]:::build
                click D1E_MailPHP "https://github.com/pacodiz02/pi/blob/main/demos/demo1/web-estatico/mail/contact.php"
            end
            subgraph "Web-HTML"
                direction TB
                D1H_HTML["Pure HTML Pages"]:::build
                click D1H_HTML "https://github.com/pacodiz02/pi/tree/main/demos/demo1/web-html"
            end
        end

        subgraph "Demo2"
            direction TB
            subgraph "Web-Estático" 
                direction TB
                D2E_SCSS["SCSS Source"]:::build
                click D2E_SCSS "https://github.com/pacodiz02/pi/tree/main/demos/demo2/web-estatico/scss/"
                D2E_CSS["Built CSS\n(style.css)"]:::build
                click D2E_CSS "https://github.com/pacodiz02/pi/blob/main/demos/demo2/web-estatico/css/style.css"
                D2E_JS["Built JS\n(main.js)"]:::build
                click D2E_JS "https://github.com/pacodiz02/pi/blob/main/demos/demo2/web-estatico/js/main.js"
                D2E_Lib["3rd-Party Libs"]:::build
                click D2E_Lib "https://github.com/pacodiz02/pi/tree/main/demos/demo2/web-estatico/lib/"
                D2E_MailJS["Mail Handler JS"]:::build
                click D2E_MailJS "https://github.com/pacodiz02/pi/blob/main/demos/demo2/web-estatico/mail/contact.js"
                D2E_MailPHP["Mail Handler PHP"]:::build
                click D2E_MailPHP "https://github.com/pacodiz02/pi/blob/main/demos/demo2/web-estatico/mail/contact.php"
            end
            subgraph "Web-HTML"
                direction TB
                D2H_HTML["Pure HTML Pages"]:::build
                click D2H_HTML "https://github.com/pacodiz02/pi/tree/main/demos/demo2/web-html"
            end
        end
    end

    %% Production Environment
    subgraph "PRO Environment"
        direction TB
        PRO_Server["Web Server\n(Nginx/Apache)"]:::env
        PRO_Config["PRO/web-pdu.conf"]:::env
        click PRO_Config "https://github.com/pacodiz02/pi/blob/main/PRO/web-pdu.conf"
    end

    %% Client Configuration Service
    ClientConfig["client-config/config.json"]:::configRepo
    click ClientConfig "https://github.com/pacodiz02/pi/blob/main/client-config/config.json"

    %% Clients
    Client["End User Browser"]:::client

    %% Flows
    ConfigRepo -->|"Trigger"| CICD
    CICD -->|"Deploy configs & assets"| PRE_Server
    PRE_Server -->|"Serve demo sites"| Client
    PRE_Server -->|"Approve & Promote"| PRO_Server
    CICD -->|"Deploy to PRO"| PRO_Server
    Client -->|"GET /, /client-config/config.json"| PRE_Server
    Client -->|"GET /, /client-config/config.json"| PRO_Server
    Client -->|"POST /mail/contact.php"| PRE_Server
    Client -->|"POST /mail/contact.php"| PRO_Server

    %% Styles
    classDef configRepo fill:#e0f7fa,stroke:#00796b;
    classDef pipeline fill:#c8e6c9,stroke:#388e3c;
    classDef env fill:#bbdefb,stroke:#1976d2;
    classDef build fill:#ffe0b2,stroke:#e65100;
    classDef client fill:#eeeeee,stroke:#757575;
```
