How ccp-g18/misw4502-proyecto-final2-frontend-web works
Project type and purpose
• This is a single-page application (SPA) built with React and Vite.
• It is purely a front-end client that consumes external REST APIs (auth, products, sellers, etc.).
• Infrastructure is managed via Terraform (main.tf), and the app is containerized (Dockerfile) and deployed to Google Cloud (gcloudignore, nginx.conf).
File structure
• Top-level files:
• .github/workflows/*.yml → CI/CD pipelines (build, test, deploy)
• main.tf → Terraform configuration for provisioning cloud resources
• Dockerfile + app/nginx.conf → container definition and server config
• “app/” directory:
• package.json, pnpm-lock.yaml, vite.config.js → build & dependency management
• src/ → React source code
– api/ → modules for calling external services
– components/, layouts/, pages/, routes/ → UI structure following a component-based (and some Router-based) pattern
– context/ → React Context for auth and notifications
– tests/ → unit & integration tests
• Public/assets and index.html → static assets and the SPA entry point
README for additional insights
• Confirms use of React + Vite with HMR and ESLint
• References how to extend linting and adopt TypeScript (optional future step)
a. Main components
1. Developer workstation (IDE, Git)
2. GitHub repository & Actions (CI/CD)
3. Terraform orchestrator (main.tf)
4. Container registry (e.g. GCR)
5. Google Cloud deployment (Cloud Run / GCS + Nginx)
6. Browser (user) running React SPA
7. External REST API services (Auth, Products, Sellers, etc.)
b. Relationships & interactions
• Developer pushes code → GitHub Actions triggers CI (install, lint, test) → build Docker image → push to registry
• CD pipeline: Terraform applies infrastructure → deploys container to Cloud Run (or GCS + Nginx)
• Browser fetches static bundle from the container’s Nginx server
• SPA issues HTTP requests to external APIs (auth.js, products.js, etc.)
c. Architectural patterns & design principles
• Component-based UI (React)
• Separation of concerns: API layer (src/api), state management (contexts), presentation (components/pages)
• Infrastructure as Code (Terraform)
• CI/CD pipeline for automated testing and deployment
d. Key technologies/frameworks
• React + Vite (build tool, HMR)
• ESLint (code quality)
• pnpm (package manager)
• Docker + Nginx (containerized web server)
• Terraform (IaC)
• GitHub Actions (CI/CD)