This is a full-stack E-commerce web application designed to provide a seamless online shopping experience. It features user authentication, product browsing, cart management, order processing, and more. The project is organized into a frontend (React) and a backend (Node.js/Express + MongoDB).
- React.js: UI library for building interactive user interfaces.
- React Router: For client-side routing and navigation.
- Redux: State management for authentication and cart.
- Context API: For local state management (e.g., Snackbar, Cart, Favorites).
- CSS Modules: Scoped and modular CSS for styling components.
- Axios/Fetch: For making HTTP requests to the backend.
- Firebase: (Optional) For additional services like authentication or storage.
- Node.js: JavaScript runtime for server-side logic.
- Express.js: Web framework for building RESTful APIs.
- MongoDB: NoSQL database for storing users, products, and orders.
- Mongoose: ODM for MongoDB, providing schema and model support.
- dotenv: For environment variable management.
- CORS: Middleware to handle Cross-Origin Resource Sharing.
- body-parser: Middleware to parse incoming request bodies.
- User registration and login (authentication)
- Profile management
- Password security (hashed storage)
- Protected routes (only accessible to logged-in users)
- Product listing and details
- Product categories and featured sections
- Search and filter products
- Add to cart and manage cart items
- Add to favorites/wishlist
- Cart management (add, remove, update quantity)
- Order summary and checkout process
- Payment integration (e.g., Razorpay)
- Order success and confirmation page
- Latest blog section
- About Us, Contact Us, and FAQ pages
- Responsive design for mobile and desktop
- Loader and Snackbar notifications
- Offline notice and error handling
- 404 Not Found page
E-commerce/
my-app/
backend/
Controllers/ # Express controllers for business logic
middleware/ # Custom middleware (e.g., auth)
Models/ # Mongoose models (User, Product)
Routes/ # Express route definitions
server.js # Main server entry point
package.json # Backend dependencies
frontend/
public/ # Static assets
src/
components/ # Reusable React components
contexts/ # React Context providers
Pages/ # Page-level React components
Redux/ # Redux store and slices
services/ # API service functions
store/ # Context stores (Cart, Favorites)
util/ # Utility functions and data
App.js # Main React app
index.js # Entry point
package.json # Frontend dependencies
-
Install dependencies:
cd my-app/backend npm install -
Create a
.envfile:MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret NODE_ENV=development PORT=5000 -
Start the backend server:
# For development (with auto-reload) npm run dev # For production npm start
The backend will run on
http://localhost:5000by default.
-
Install dependencies:
cd my-app/frontend npm install -
Firebase Configuration:
- The Firebase config is located in
src/firebase.js. - If you want to use your own Firebase project, replace the config object with your credentials.
- Important: In the Firebase Console, add your deployed domain (e.g.,
furniflexx.netlify.app) to the list of authorized domains for authentication.
- The Firebase config is located in
-
Start the frontend:
npm start
The frontend will run on
http://localhost:3000by default.
MONGO_URI- MongoDB connection stringJWT_SECRET- Secret for JWT token signingNODE_ENV- (optional)developmentorproductionPORT- (optional) Port for backend server (default: 5000)
- Firebase config is hardcoded in
src/firebase.js. For production, consider using environment variables or a secure config method.
GET /api/products- Get all productsGET /api/products/:id- Get product by IDPOST /api/products- Add a new productPOST /api/products/bulk- Add multiple products
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/google- Google OAuth loginGET /api/user/profile- Get user profile (protected)POST /api/user/order- Add order to user history (protected)
POST /api/contact- Submit contact form
- Uses JWT for backend API protection.
- Google login and email/password via Firebase Auth.
- To enable Google login on production, add your domain to Firebase Console → Authentication → Settings → Authorized domains.
- Frontend: Deploy the
frontendbuild folder to Netlify, Vercel, or any static hosting. - Backend: Deploy the
backendto a Node.js server (Heroku, Render, etc.). Make sure to set environment variables.
- For local development, add
localhostto Firebase authorized domains. - If you encounter
Unrecognized feature: 'otp-credentials', it is a browser warning and can be ignored unless using Web OTP API. - For Google login issues, ensure your domain is authorized in Firebase.
Happy coding!