How thesisprjteamtamk-long-le-kiet-nguyen/shopping_app_thesis works
Main Components
• Frontend Client:
– This is located in the “client” directory and is clearly a React/TypeScript application (files such as App.tsx, main.tsx, index.html, TailwindCSS configuration, etc.).
– It includes many components (for checkout, product listings, login/signup, seller pages, and various UI components) and service modules (like authService, productService, etc.) that interact with the backend via HTTP calls.
• Backend Server:
– The server entry point is in “server.ts”.
– Separate concerns are achieved via controllers (for business logic like handling products, orders, payments, cart, login) and models (for data representations – e.g., product, order, user, cart).
– Routes are organized in the “routes” directory, mapping URL endpoints to the appropriate controller methods.
– Utility modules under “utils” (for authentication middleware, logging, configuration) provide cross-cutting services.
• Types/Interfaces:
– Both frontend (inside “client/src/types”) and backend (in “types”) have definition files to ensure consistency in API contracts.
• External Components (Assumed):
– Although not directly included in the file tree, the design likely involves a database (or external persistent storage) that supports the models.
– Payment integration (given the presence of paymentService and StripePaymentForm components) interacts with external payment gateways.
Relationships and Data Flow
• The controllers manipulate or retrieve data via models and may perform further operations (e.g., logging, authentication) using utilities.
• For administrative tasks (from SellerPage components and corresponding admin controllers), specific endpoints (possibly via “routes” and “controllers”) handle CRUD operations concerning products like Rackets, Shoes, Shuttlecocks, etc.
• External services like payment processors are integrated through dedicated components and routes (for instance, using the Stripe integration mentioned in the checkout components).
Architectural Patterns and Design Principles
• The project adopts an MVC (Model-View-Controller) pattern on the backend by separating concerns:
– Models define the data schema, Controllers encapsulate the business logic, and Routes define the endpoints.
• The frontend segregation into components following containers and presentation components promotes reusability and organized state management (possibly via the AuthContext and services).
• There is a clear emphasis on maintainability and separation between concerns (i.e., separate directories for UI components, service calls, context, and utilities).
Relevant Technologies, Frameworks, and Libraries
• Frontend: React with TypeScript, TailwindCSS, and various custom UI components (as seen in the “ui” directory).
• Backend: Node.js with Express (implied by controllers, routes, and middleware structure), TypeScript, and standard tools like ESLint (config files at the project root and inside client).
• Integration with external services such as payment gateways (Stripe as seen in the payment and checkout components).