How codervu/capstoneproject-fe works
Project type and purpose
• This is a single-page e-commerce web application built with Create React App. It combines both a public storefront (product listings, shopping cart, checkout, chat, notifications) and an admin portal (category, product, order, discount, customer, statistics management). It uses React for UI, Redux for state, Axios-based services for API calls, and WebSockets for live notifications. It is deployed as a static app (Azure Static Web Apps).
File structure
• Top-level “public”/“build”: static hosting assets
• src/
• components & pages: UI layer (organized by feature and layout)
• redux: actions, reducers, services, store—state management and API integration
• ws: WebSocket configuration and notification service
• lib, constants, assets: utilities and static resources
• GitHub Actions workflow and staticwebapp.config.json: CI/CD & hosting config
• tailwind.config.js & postcss.config.js: styling pipeline
README for additional insights
• Bootstrapped by Create React App
• Standard scripts (start, build, test, eject)
• Deployment target is Azure Static Web Apps
a. Main components
• Browser/Client
• Static Hosting (Azure Static Web Apps + CDN)
• React SPA (UI Layer)
• Redux Store & Middleware
• HTTP API Services (auth, products, cart, orders, chat, etc.)
• WebSocket Service (orderNotificationService)
• External Backend Services (REST API server, WebSocket server, Database)
• CI/CD Pipeline (GitHub Actions → Azure)
b. Relationships & interactions
• Browser loads index.html from Azure Static Web Apps / CDN.
• React App initializes Redux store and WebSocket connection.
• UI components dispatch Redux actions → invoke redux/services → send HTTP requests (via Axios) to Backend REST endpoints.
• redux/services receive responses → dispatch reducers → update store → UI re-renders.
• ws/orderNotificationService opens socket to backend WebSocket server → receives push events → dispatches store updates → UI notifications.
• GitHub Actions triggers on push → npm run build → deploys build/ to Azure Static Web Apps.
c. Architectural patterns & design principles
• Layered architecture: Presentation (React components/pages), Application State (Redux store/slices), Integration (Axios services, WebSocket), Infrastructure (static hosting, CI/CD).
• Feature-based folder structure for scalability.
• Single source of truth: Redux.
• Separation of concerns: components are “dumb” and receive data/dispatch actions, business logic lives in redux/services and slices.
d. Technologies & frameworks
• React (UI)
• Redux (state management)
• Axios (HTTP client via redux/setup/axios.js)
• WebSocket (ws/configSocket.js & orderNotificationService)
• Tailwind CSS & PostCSS (styling)
• Azure Static Web Apps (hosting)
• GitHub Actions (CI/CD workflow)
Detail level
• Include:
• Client startup → loads index.html & JS bundles
• React Router handling for public vs. admin routes
• Redux store initialization (orebiSlice, rootReducer, store.js)
• Middleware layers (redux/setup/ai.js for AI features)
• Service modules calling endpoints (e.g., productService, cartService)
• WebSocket handshake and event flow
• CI/CD: GitHub Actions job → staticwebapp.config.json rules → Azure deployment