How javieralonsodiaz/mi-pagina-web works
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