A modern, full-stack e-commerce application built with React and Node.js, featuring user authentication, product management, shopping cart, order processing, and an admin dashboard.
Live Demo: https://e-commerce-mauve-sigma.vercel.app/
-
User Authentication
- User registration and login
- Google OAuth integration
- JWT-based authentication
- Protected routes
-
Product Management
- Browse products with pagination
- Product search functionality
- Featured products display
- Product categories and filtering
- Product reviews and ratings
-
Shopping Experience
- Shopping cart with local storage
- Add/remove items from cart
- Quantity management
- Secure checkout process
-
Order Management
- Order placement and tracking
- Order history
- Order status updates
-
Admin Dashboard
- Product management (CRUD operations)
- Order management
- User management
-
User Profile
- Profile management
- Order history
- Account settings
- React 18 - UI library
- React Router DOM - Routing
- Redux Toolkit - State management
- Axios - HTTP client
- Tailwind CSS - Styling
- React OAuth Google - Google authentication
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM
- JWT - Authentication tokens
- Bcryptjs - Password hashing
- CORS - Cross-origin resource sharing
ecommerce/
├── backend/
│ ├── config/
│ │ └── db.js # Database connection
│ ├── controllers/
│ │ ├── cartController.js
│ │ ├── orderController.js
│ │ ├── productController.js
│ │ └── userController.js
│ ├── middleware/
│ │ ├── authMiddleware.js
│ │ └── errorMiddleware.js
│ ├── models/
│ │ ├── Cart.js
│ │ ├── Order.js
│ │ ├── Product.js
│ │ └── User.js
│ ├── routes/
│ │ ├── cartRoutes.js
│ │ ├── orderRoutes.js
│ │ ├── productRoutes.js
│ │ └── userRoutes.js
│ ├── utils/
│ │ └── generateToken.js
│ ├── server.js
│ └── package.json
│
├── frontend/
│ ├── public/
│ │ ├── images/
│ │ └── index.html
│ ├── src/
│ │ ├── components/
│ │ │ ├── Footer.jsx
│ │ │ ├── Header.jsx
│ │ │ └── SearchBar.jsx
│ │ ├── pages/
│ │ │ ├── AdminDashboard.jsx
│ │ │ ├── CartPage.jsx
│ │ │ ├── CheckoutPage.jsx
│ │ │ ├── HomePage.jsx
│ │ │ ├── LoginPage.jsx
│ │ │ ├── ProductPage.jsx
│ │ │ ├── ProfilePage.jsx
│ │ │ ├── RegisterPage.jsx
│ │ │ ├── SearchResultsPage.jsx
│ │ │ └── ShopPage.jsx
│ │ ├── utils/
│ │ │ └── api.js
│ │ ├── App.jsx
│ │ ├── index.js
│ │ └── index.css
│ └── package.json
│
└── README.md
- Node.js (v14 or higher)
- MongoDB (local or cloud instance like MongoDB Atlas)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd ecommerce
-
Install backend dependencies
cd backend npm install -
Install frontend dependencies
cd ../frontend npm install -
Configure environment variables
Create a
.envfile in thebackenddirectory:MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key PORT=5000 FRONTEND_URL=http://localhost:3000 GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret
Create a
.envfile in thefrontenddirectory (if needed):REACT_APP_API_URL=http://localhost:5000
-
Start the backend server
cd backend npm run devThe backend will run on
http://localhost:5000 -
Start the frontend development server
cd frontend npm startThe frontend will run on
http://localhost:3000
-
Build the frontend
cd frontend npm run build -
Start the backend
cd backend npm start
POST /api/users/register- Register a new userPOST /api/users/login- User loginPOST /api/users/google-login- Google OAuth login
GET /api/products- Get all products (with pagination and filters)GET /api/products/:id- Get product by IDPOST /api/products- Create product (Admin only)PUT /api/products/:id- Update product (Admin only)DELETE /api/products/:id- Delete product (Admin only)
GET /api/cart- Get user's cartPOST /api/cart- Add item to cartPUT /api/cart/:id- Update cart itemDELETE /api/cart/:id- Remove item from cart
GET /api/orders- Get user's ordersPOST /api/orders- Create new orderGET /api/orders/:id- Get order by IDPUT /api/orders/:id- Update order status (Admin only)
The application is currently deployed on Vercel:
- Frontend: Vercel
- Backend: Configure your backend deployment (e.g., Heroku, Railway, or Vercel Serverless Functions)
- Database: MongoDB Atlas (recommended for production)
- Password hashing with bcryptjs
- JWT token-based authentication
- Protected API routes with middleware
- CORS configuration
- Input validation and error handling
Built with ❤️ for modern e-commerce experiences.
Note: This project is currently in development. Some features may be subject to change.