# chechu15/mi-pagina-web architecture

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

- Interactive diagram: https://gitdiagram.com/chechu15/mi-pagina-web
- Repository: https://github.com/chechu15/mi-pagina-web

## Overview

##### Project Type and Purpose
- Full-stack React application with:
– Server-side rendering (SSR)
– Client-side hydration via React Router
– TypeScript + TailwindCSS
– Built and served via Vite (dev) or Docker/Firebase (prod)
- Purpose: fast SSR+CSR hybrid web app, with CI/CD deploys to Firebase Hosting (or any container platform).

##### File Structure
– app/ : all React routes, root.tsx, global CSS
– public/ : static index.html and 404 fallback
– react-router.config.ts : route conventions
– vite.config.ts & tsconfig.json : build/tooling configuration
– Dockerfile + .dockerignore : containerized build
– .firebase/* + firebase.json + .firebaserc : Firebase Hosting setup
– .github/workflows/*.yml : CI/CD for Firebase deploy on PR/merge

##### Main Components to Model
A. Developer Machine / CI Pipeline
- Source code in GitHub → GitHub Actions workflows
- Builds (npm run build or docker build) → Artifact (build/, container image)
B. Dev Environment
- Vite Dev Server (HMR + SSR proxy)
- Browser (client code, React hydration)
C. Production Environment
- Hosting platform (Firebase Hosting or Docker-based host)
- Node SSR Server (serves SSR HTML + APIs)
- Static Asset CDN (serves client JS/CSS from build/client)
D. (Optional) External Services
- Any REST/GraphQL backends or external APIs called from loaders/actions

##### Relationships & Data Flows
– Browser → HTTP GET / → SSR Server → HTML+Initial Data → Browser
– Browser → JS bundles (from CDN or /build/client) → React hydrates
– User navigation → React Router (client) fetches data via fetch/loaders → updates UI
– CI (on push) → GitHub Actions → build + firebase deploy
– Docker image → Container registry → Cloud host runs Node SSR

##### Architectural Patterns & Principles
– SSR + CSR Hybrid: initial SSR for SEO/performance, CSR for routing transitions
– Nested route modules: each route file exports loader, action, component
– Single-codebase monolith: front+server in one repo, split at build time
– Infrastructure as code: Firebase + Docker + GitHub Actions declarative configs

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer & CI Layer
    subgraph "Developer & CI"
        direction TB
        GHRepo["GitHub Repo"]:::developer
        GHActions["GitHub Actions"]:::developer
        GHRepo -->|push/merge| GHActions
    end

    %% Development Environment
    subgraph "Development Environment"
        direction TB
        Vite["Vite Dev Server"]:::server
        ReactAppDev["React App (app/*)"]:::client
        Browser["Browser"]:::client
        ReactAppDev -->|served via Vite| Vite
        Vite -->|HMR & SSR Proxy| Browser
    end

    %% Production Build & CI
    subgraph "Production Build"
        direction TB
        GHActions -->|trigger build| Dkr["Docker Build"]:::developer
        ReactAppProd["React App (app/*)"]:::client
        ReactAppProd -->|docker build context| Dkr
        Dkr -->|docker build| DkrImage["Container Image"]:::blue
    end

    %% Hosting & Deployment
    subgraph "Hosting Platform"
        direction TB
        DkrImage -->|push image & deploy| FirebaseHosting["Firebase Hosting"]:::infra
        PublicAssets["Public Static Assets"]:::client
        CDN["Static Asset CDN"]:::infra
        SSRServer["Node SSR Server"]:::server
        FirebaseHosting -->|serves static assets| CDN
        FirebaseHosting -->|invokes SSR functions| SSRServer
        PublicAssets -->|fallback assets| FirebaseHosting
    end

    %% Runtime Interactions
    subgraph "Runtime Flow"
        direction TB
        SSRServer -->|HTTP GET / → SSR HTML + Data| Browser
        CDN -->|JS/CSS bundles| Browser
        Browser -->|hydrate & React Router navigation| ReactAppProd
        Browser -->|fetch/loaders via HTTP| SSRServer
    end

    %% Configuration & Metadata
    subgraph "Configuration & Metadata"
        direction TB
        Configs["Config Files & Metadata"]:::developer
        Configs --> GHActions
        Configs --> Dkr
        Configs --> FirebaseHosting
    end

    %% Public Assets
    PublicAssets

    %% Click Events
    click GHActions "https://github.com/chechu15/mi-pagina-web/blob/main/.github/workflows/firebase-hosting-pull-request.yml"
    click GHActions "https://github.com/chechu15/mi-pagina-web/blob/main/.github/workflows/firebase-hosting-merge.yml"
    click Vite "https://github.com/chechu15/mi-pagina-web/blob/main/vite.config.ts"
    click ReactAppDev "https://github.com/chechu15/mi-pagina-web/blob/main/app/root.tsx"
    click ReactAppDev "https://github.com/chechu15/mi-pagina-web/blob/main/app/routes.ts"
    click ReactAppDev "https://github.com/chechu15/mi-pagina-web/blob/main/app/routes/home.tsx"
    click ReactAppDev "https://github.com/chechu15/mi-pagina-web/blob/main/app/welcome/welcome.tsx"
    click ReactAppDev "https://github.com/chechu15/mi-pagina-web/blob/main/app/app.css"
    click ReactAppProd "https://github.com/chechu15/mi-pagina-web/blob/main/app/root.tsx"
    click ReactAppProd "https://github.com/chechu15/mi-pagina-web/blob/main/app/routes.ts"
    click ReactAppProd "https://github.com/chechu15/mi-pagina-web/blob/main/app/routes/home.tsx"
    click ReactAppProd "https://github.com/chechu15/mi-pagina-web/blob/main/app/welcome/welcome.tsx"
    click ReactAppProd "https://github.com/chechu15/mi-pagina-web/blob/main/app/app.css"
    click PublicAssets "https://github.com/chechu15/mi-pagina-web/blob/main/public/index.html"
    click PublicAssets "https://github.com/chechu15/mi-pagina-web/blob/main/public/404.html"
    click Dkr "https://github.com/chechu15/mi-pagina-web/tree/main/Dockerfile"
    click Dkr "https://github.com/chechu15/mi-pagina-web/blob/main/.dockerignore"
    click FirebaseHosting "https://github.com/chechu15/mi-pagina-web/blob/main/firebase.json"
    click FirebaseHosting "https://github.com/chechu15/mi-pagina-web/blob/main/.firebaserc"
    click FirebaseHosting "https://github.com/chechu15/mi-pagina-web/blob/main/.firebase/hosting.YnVpbGQvY2xpZW50.cache"
    click FirebaseHosting "https://github.com/chechu15/mi-pagina-web/blob/main/.firebase/hosting.cHVibGlj.cache"
    click Configs "https://github.com/chechu15/mi-pagina-web/blob/main/react-router.config.ts"
    click Configs "https://github.com/chechu15/mi-pagina-web/blob/main/tsconfig.json"
    click Configs "https://github.com/chechu15/mi-pagina-web/blob/main/package.json"
    click Configs "https://github.com/chechu15/mi-pagina-web/blob/main/package-lock.json"
    click Configs "https://github.com/chechu15/mi-pagina-web/blob/main/README.md"

    %% Styles
    classDef developer fill:#e3fcef,stroke:#2f855a,color:#22543d
    classDef server fill:#ebf8ff,stroke:#2b6cb0,color:#2c5282
    classDef client fill:#fff7ed,stroke:#dd6b20,color:#972a0d
    classDef infra fill:#f5f3ff,stroke:#805ad5,color:#553c9a
```
