How sivaprasathm93/amazon-clone works
Main Components
• Frontend:
• Built primarily with React and TypeScript.
• Contains pages (Home, ProductDetail, Cart, Login) and shared components (Navbar, Footer, ProductSlider, TrendingProducts, UpcomingProducts).
• Uses state management (with Context or Redux as indicated in the README) for managing the shopping cart.
• Employs routing (React Router) and integrates styling with Tailwind CSS and SCSS.
• Backend:
• A Node.js + Express server (located in the “server” directory with TypeScript in server/src/server.ts).
• Uses middleware and routing to handle API endpoints for authentication and data retrieval.
• Leverages libraries such as Mongoose for MongoDB operations, JSON Web Tokens (JWT) for authentication, bcryptjs for password hashing, and dotenv for configuration.
• Manages environment-specific details via a .env file.
• Database & External Services:
• MongoDB (the project uses MongoDB via Mongoose for storing user data).
• External integrations like Stripe.js are used in the checkout process.
• Firebase is also mentioned in the README as a backend service for authentication and database, so if that is active, it should be highlighted as an alternative integration or supplemental service.
• Additional Elements:
• Product data is partly fed by local JSON files.
• The checkout process integration with Stripe.
Relationships and Interactions
• Frontend to Backend:
• Use API calls (via Axios) from the React frontend to the Express server.
• Use JWT tokens to secure routes; the client stores these tokens (through cookies or local storage) and sends them with HTTP requests.
• Backend to Database:
• The Express server communicates with MongoDB through Mongoose.
• CRUD operations for user data, order management, and other backend services take place here.
• External Services:
• During the checkout process, the backend connects with Stripe.
• Firebase (if enabled) may be used as an additional authentication or database service.
Architectural Patterns and Principles
• Separation of Concerns:
• Distinct separation between frontend and backend responsibilities.
• Modular Design:
• Frontend: Organized into components, pages, contexts, and assets.
• Backend: Organized into TypeScript files and configurations that support scalability.
• Dependency Management & Security:
• Use of JWT for authentication.
• Usage of environment variables to secure sensitive credentials (via dotenv).
• API Layer:
• Clearly defined endpoints which communicate between the client and server.
Relevant Technologies and Frameworks
• Frontend: React, TypeScript, Tailwind CSS, SCSS, React Router, Redux (or Context as applicable), Axios.
• Backend: Node.js, Express, Mongoose (MongoDB), JWT, bcryptjs, dotenv, cors.
• Other: Possibly Firebase (as indicated) for some backend services, and external payment integration via Stripe.js.