How hq-nguyen/beautyskin-client works
Project type and purpose
• This is a single-page frontend application (built with ReactJS and Vite) for a Skincare Shop Management System.
• It provides UIs for customers, staff, and admins, handling everything from product browsing and skin-type quizzes to order checkout and feedback submission.
File structure
• Top-level configuration & build files: package.json, vite.config.js, tailwind.config.js, deploy.sh, .gitignore.
• “public” holds static assets (favicon, index.html template).
• “src” is the heart of the app:
• App.jsx, main.jsx bootstrap the React application.
• config/ (axios + firebase setup)
• apis/ (REST API wrappers for blog, product, order, customer, staff, etc.)
• redux/ (Redux store + slices for cart, compare, user)
• contexts/ (React Contexts for feedback & product)
• components/ (reusable UI pieces grouped by feature)
• layout/ (layout components for Main, Admin, Staff, Checkout, Support)
• pages/ (page-level components mapped to routes)
• routes/ (ProtectedRoute & Routers.jsx define client-side routing)
Pulling in README insights
• Confirms ReactJS + TailwindCSS + RESTful API integration.
• High-level features: Homepage, Skin Testing, Product Recommendations, Feedback.
a. Main components to represent:
• Browser (Client)
• Vite / dev server (for development)
• React Application (SPA)
– React Router (Routers.jsx + ProtectedRoute)
– Layouts (MainLayout, AdminLayout, etc.)
– Pages (Home, Shop, Checkout, Admin Dashboards, Quiz, etc.)
– Components (Navbar, Footer, Card, Sidebar, etc.)
– State management
· Redux Store (cartSlice, compareSlice, userSlice)
· Context Providers (FeedbackContext, ProductContext)
• API Layer
– Axios instance (src/config/axios.js)
– RESTful endpoints (src/apis/*)
• External Services
– Backend API (VITE_API_BASE_URL)
– Firebase (Auth, Storage)
b. Relationships and interactions
• Browser sends HTTP(S) requests to the Vite dev server (or static files in production).
• Vite serves the React bundle.
• React Router maps URL → Page component.
• Page components dispatch actions to Redux or call Context methods.
• Redux/Context invoke axios to call external Backend API or Firebase services.
• Responses flow back → Redux store/Context → UI components update.
c. Architectural patterns & design principles
• SPA (Single-Page Application) with client-side routing (React Router).
• Component-based architecture, feature grouping in “components/” and “pages/”.
• Separation of concerns:
– UI layer (components + layouts)
– State layer (Redux + Context)
– API layer (axios wrappers)
• Environment/config isolation via .env and src/config.
• Reusable hooks (src/hooks/*) and utils (src/utils/*).
d. Key technologies & libraries
• ReactJS + Vite
• React Router
• Redux Toolkit
• React Context API
• Axios
• TailwindCSS
• Firebase SDK
Elements
• Clear labels for each component (e.g., “Redux Store”, “FeedbackContext Provider”)
– Browser → React Router → Page → API call → Backend
– API response → Redux/Context → Component render
– Green for state management (Redux/Context)
– Orange for API layer
– Gray for external systems (Backend API, Firebase)