# javieralonsodiaz/mi-pagina-web architecture

> Architecture diagram of the GitHub repository javieralonsodiaz/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/javieralonsodiaz/mi-pagina-web
- Repository: https://github.com/javieralonsodiaz/mi-pagina-web

## Overview

##### Project Type and Purpose
- This is a full-stack React application template using React Router v6 with server-side rendering (SSR) powered by Vite.
- It bundles client assets, handles data loading/mutations via loader functions in your route modules, and outputs a production-ready Node server along with static assets.
- It’s deployable via Docker or directly to Firebase Hosting (or any container-based platform).

##### File Structure Highlights
- app/
- root.tsx – the root React component for SSR hydration
- routes/ – each .tsx file under here is a route module with optional loader/action functions
- app.css – global Tailwind CSS imports
- react-router.config.ts – optional central route definitions
- vite.config.ts & tsconfig.json – Vite and TypeScript configurations
- Dockerfile – shows how the app is containerized
- firebase.json & .firebaserc – Firebase Hosting configuration
- public/ – static assets that bypass Vite’s build

##### Key Components
a. Development & CI/CD
- Developer workstation (VS Code, etc.)
- GitHub repository + Actions workflows (firebase-hosting-pull-request.yml, firebase-hosting-merge.yml)
b. Build & Publish
- Vite build step (npm run build) producing a build/ directory with client & server bundles
- Docker build context → container image → container registry (optional)
c. Runtime Architecture
- Node.js SSR server (serves server bundle, handles loader/action functions, streams HTML)
- Client browser (fetches JS/CSS, hydrates React app)
- TailwindCSS-generated stylesheet
- Firebase Hosting (CDN layer serving static client assets and proxying SSR requests to the Node server)
d. External Services (if any)

##### Relationships & Data Flow
- Developer → Git push → GitHub Actions → Build / Test → Docker Image
- Docker Image → Firebase Hosting or container platform → Node SSR server + CDN
- Browser request → Firebase CDN → (a) static asset if path matches /build/client/* or /public/*
→ (b) SSR request forwarded to Node server → React Router SSR → HTML + initial data → Browser
- Browser hydration → subsequent route navigations use React Router client navigation + loader calls (fetch from same server or API endpoints)

##### Architectural Patterns & Principles
- Full-stack routing: route modules collocate UI + data loading + mutations
- SSR for performance & SEO, HMR in development for fast feedback
- Clear separation: “client” vs “server” bundles, static vs dynamic routes
- Containerization for environment parity

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Development & CI/CD Layer
    subgraph "Development & CI/CD"
        Dev["Developer Workstation"]:::green
        Repo["GitHub Repository"]:::blue
        PRWorkflow["PR Workflow"]:::blue
        MergeWorkflow["Merge Workflow"]:::blue

        Dev -->|push code| Repo
        Repo -->|triggers| PRWorkflow
        Repo -->|triggers| MergeWorkflow
    end

    %% Build & Deployment Layer
    subgraph "Build & Deployment"
        ViteBuild["Vite Build (npm run build)"]:::blue
        DockerContext["Docker Context"]:::blue
        DockerBuild["Docker Build (Dockerfile)"]:::blue
        DockerRegistry["Container Registry"]:::blue

        Repo -->|CI runs build| ViteBuild
        ViteBuild -->|outputs client & server bundles| DockerContext
        DockerContext -->|docker build| DockerBuild
        DockerBuild -->|push image| DockerRegistry
    end

    %% Runtime Layer
    subgraph "Runtime"
        FH["Firebase Hosting CDN"]:::green
        SSR["Node SSR Server"]:::green
        Browser["Client Browser"]:::green
        ExternalAPI["External API / Database"]:::orange

        Browser -->|navigate/request| FH
        FH -->|serve static assets| Browser
        FH -->|proxy SSR requests| SSR
        SSR -->|loader/action calls| ExternalAPI
        SSR -->|stream HTML+data| Browser
    end

    %% Code & Config Components
    subgraph "Code & Config"
        ViteConfig["vite.config.ts"]:::blue
        TSConfig["tsconfig.json"]:::blue
        PkgJSON["package.json"]:::blue
        PackageLock["package-lock.json"]:::blue
        RouterConfig["react-router.config.ts"]:::blue

        RootComp["app/root.tsx"]:::green
        RoutesTS["app/routes.ts"]:::green
        HomeRoute["app/routes/home.tsx"]:::green
        WelcomeRoute["app/welcome/welcome.tsx"]:::green
        CSS["app/app.css"]:::blue
        Public["public/"]:::blue

        FirebaseJSON["firebase.json"]:::blue
        FirebaseRC[".firebaserc"]:::blue
        FirebaseHosting[".firebase/hosting.*"]:::blue
        Dockerfile["Dockerfile"]:::blue
        DockerIgnore[".dockerignore"]:::blue
    end

    %% Component relationships
    ViteConfig --> ViteBuild
    TSConfig --> ViteBuild
    PkgJSON --> ViteBuild
    PackageLock --> ViteBuild
    RouterConfig --> ViteBuild

    RootComp --> ViteBuild
    RoutesTS --> ViteBuild
    HomeRoute --> ViteBuild
    WelcomeRoute --> ViteBuild
    CSS --> ViteBuild
    Public --> FH

    FirebaseJSON --> FH
    FirebaseRC --> FH
    FirebaseHosting --> FH

    Dockerfile --> DockerContext
    DockerIgnore --> DockerContext

    PkgJSON -->|dev scripts| Dev

    %% Click Events
    click PRWorkflow "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/.github/workflows/firebase-hosting-pull-request.yml"
    click MergeWorkflow "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/.github/workflows/firebase-hosting-merge.yml"
    click Dockerfile "https://github.com/javieralonsodiaz/mi-pagina-web/tree/main/Dockerfile"
    click DockerIgnore "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/.dockerignore"
    click ViteConfig "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/vite.config.ts"
    click TSConfig "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/tsconfig.json"
    click PkgJSON "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/package.json"
    click PackageLock "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/package-lock.json"
    click RouterConfig "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/react-router.config.ts"
    click RootComp "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/app/root.tsx"
    click RoutesTS "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/app/routes.ts"
    click HomeRoute "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/app/routes/home.tsx"
    click WelcomeRoute "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/app/welcome/welcome.tsx"
    click CSS "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/app/app.css"
    click Public "https://github.com/javieralonsodiaz/mi-pagina-web/tree/main/public/"
    click FirebaseJSON "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/firebase.json"
    click FirebaseRC "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/.firebaserc"
    click FirebaseHosting "https://github.com/javieralonsodiaz/mi-pagina-web/blob/main/.firebase/hosting.*"

    %% Styles
    classDef blue fill:#D0E8FF,stroke:#3B82F6,stroke-width:1px
    classDef green fill:#E2F7E1,stroke:#10B981,stroke-width:1px
    classDef orange fill:#FFE4B5,stroke:#F59E0B,stroke-width:1px
```
