How yoonjiji/casetibuy works
Main Components
• Frontend (Client)
• The client directory houses the React app. This includes various subcomponents such as pages (Home, DetailProduct, Login, SignUp, etc.), reusable components (Header, Footer, Cart, etc.), contexts (AuthContext, CartContext, etc.), and hooks that encapsulate custom business logic.
• The public folder contains static assets (images, fonts, JSON data), which the frontend renders.
• Backend (Server)
• The server directory follows an MVC-ish pattern with clear separation:
▸ Controllers – handling request logic such as cartController, memberController, orderController, etc.
▸ Routers – endpoints to map HTTP requests (e.g., cartRouter, memberRouter, etc.)
▸ Repository – database interaction via functions (db.js, productRepository, etc.)
• An upload controller/router takes care of file uploads.
• Database (MySQL)
• The SQL folder contains multiple export directories with scripts and dump files. This represents the relational database schema (tables for members, products, orders, reviews, carts, etc.).
• External APIs and Services (if applicable)
• The README mentions KakaoPay API for payment processing, so include an “External Payment Service” component.
• Other tools (such as Daum Postcode for address lookup) can be noted as external integration points.
Out the Interactions and Dataflow
• From the Client (React App):
• UI Components and pages issue HTTP requests (likely via Axios) to the relevant backend endpoints.
• State and context providers (like AuthContext, CartContext) manage user interactions, session tokens (JWT), and cart/order state.
• Backend (Express Server):
• Requests are routed via express routers to corresponding controllers.
• Controllers perform business logic (handling authentication, product details, reviews, etc.) and communicate with the repository layer.
• The repository layer interacts with the MySQL database, executing SQL queries and returning results.
• Database:
• Stores persistent data for products, users, orders, reviews, etc.
• External Service Connections:
• Payment processing (KakaoPay) and third-party address lookup (Daum Postcode) integrations.
• File Uploads and Static Assets:
• The server handles file uploads (using Multer) and serves static files as needed.
Architectural Patterns and Principles
• Separation of Concerns – clearly divided into frontend and backend layers with distinct responsibilities.
• MVC-like Pattern on the Server – controllers, routers, and repository separation.
• SPA Principles on the Client – single-page navigation with React components and context-based state management.
• RESTful API Design – backend provides endpoints for various operations (CRUD for products, orders, reviews, etc.).
• Security – use of JWT tokens for authentication.