How mychelgarzon/meatshop works
Project type and purpose
• This is a full-stack (serverless) e-commerce frontend application built in React (with Vite), backed by a single AWS Lambda (or Firebase Cloud Function) for order processing.
• Purpose: Allow users to browse premium meat products, add/remove/update items in a shopping cart (Redux), and submit orders via a serverless function.
File structure
• Top-level:
• src/ : React application source
• lambda-function/ : serverless function code
• cypress/ : end-to-end tests
• .github/workflows/main.yml : CI/CD pipeline
• firebase.json & .firebaserc : Firebase hosting & functions config
• src/ organization:
• components/ : reusable UI pieces (Banner, Cart, ProductCard, etc.)
• routes/ : page containers (Home, About, ShoppingCart, Success, etc.)
• store/ : Redux slices (cartSlice.ts, userSlice.ts) + store.ts
• data/, assets/, helpers/, hooks/, layout/ : static data, utilities, layout, custom hooks
• lambda-function:
• index.js: handler for HTTP calls (e.g., order submission)
• package.json: runtime dependencies
Key insights from README
• React + Redux for cart management
• Instructions focus on running the dev server and installing dependencies; no deep architectural docs in README
Main components
a. User’s Browser (Client)
b. React SPA (static assets + Vite server in dev; pre-built files in production)
– UI Components → Redux Store → UI updates
– Data Module (data.ts) for product catalog
c. Serverless Function (lambda-function/index.js)
– Exposes an HTTP endpoint (e.g., /submitOrder)
d. Hosting & Deployment
– Firebase Hosting (or AWS S3 + CloudFront) serves the SPA
– Firebase Functions (or AWS Lambda) runs the serverless code
– GitHub Actions CI/CD pipeline automates build & deploy
e. External Integrations (if any)
Relationships & interactions
• User clicks “Add to cart” → React Component dispatches Redux action → cartSlice updates state → UI re-renders
• User clicks “Place Order” → SPA calls serverless endpoint via fetch/Axios → Lambda processes order → returns success/failure
• CI/CD: On push to main → GitHub Actions builds React app → deploys to Firebase Hosting → deploys lambda-function
Architectural patterns & principles
• Single-Page Application (SPA) with component-based UI
• Unidirectional data flow (Redux)
• Serverless (Function as a Service) for backend logic
• Static hosting for frontend, separate runtime for API
• Automated CI/CD for consistency
Essential details to capture
• Redux store slices (cartSlice, userSlice) as part of the state layer
• Key directories (src/components, src/routes) to reflect component hierarchy
• Hosting & function deployment config (firebase.json)
• CI/CD workflow triggers (.github/workflows/main.yml)