- Overview
- Features
- Technologies Used
- Getting Started
- Project Structure
- Environment Variables
- Running the Application
- Payment Integration (Payhero)
- Admin Features
- Deployment
This is a full-stack eCommerce platform built with the MERN stack (MongoDB, Express, React, Node.js) and integrated with Payhero for secure and seamless payment processing. It includes user authentication using Firebase and features for product management, order tracking, and role-based access control for admin functionalities.
- User Authentication: Firebase integration for sign-up, login, and password recovery.
- Product Management: Add, edit, delete, and view products.
- Shopping Cart: Add/remove items, update quantities, and track totals.
- Checkout Process: Secure payments powered by Payhero.
- Order Management: Users can track orders; admins can manage order statuses.
- Admin Panel:
- Role-based access for user management.
- Dashboard with key metrics.
- Product and order management.
- Responsive Design: Fully responsive UI for desktop and mobile devices.
- React.js: For building the user interface.
- Redux: For state management.
- Bootstrap: For responsive design.
- Node.js: Server-side runtime environment.
- Express.js: Web framework for handling routes and APIs.
- MongoDB: NoSQL database for storing user and product data.
- Firebase: User authentication and password reset functionality.
- Payhero: Secure payment processing.
Ensure you have the following installed:
- Node.js (>= 16.x)
- MongoDB (local or Atlas for cloud database)
- Firebase Project
- Payhero Account
-
Clone the repository:
git clone https://github.com/yourusername/ecommerce-mern-payhero.git cd ecommerce-mern-payhero -
Install dependencies for both frontend and backend:
# Install backend dependencies cd backend npm install # Install frontend dependencies cd ../frontend npm install
root
├── backend
│ ├── controllers
│ ├── models
│ ├── routes
│ ├── middleware
│ └── server.js
├── frontend
│ ├── src
│ │ ├── components
│ │ ├── pages
│ │ ├── redux
│ │ ├── App.js
│ │ └── index.js
├── .env
├── package.json
└── README.md
Create a .env file in the backend directory with the following keys:
MONGO_URI=your_mongodb_connection_string
PORT=5000
FIREBASE_API_KEY=your_firebase_api_key
FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain
FIREBASE_PROJECT_ID=your_firebase_project_id
PAYHERO_API_KEY=your_payhero_api_key
PAYHERO_SECRET_KEY=your_payhero_secret_key-
Navigate to the backend folder and start the server:
cd backend npm start -
The backend will run on
http://localhost:5000.
-
Navigate to the frontend folder and start the React app:
cd frontend npm start -
The frontend will run on
http://localhost:3000.
- Register for a Payhero account and obtain your API keys.
- Add the keys to the
.envfile as shown above. - Payhero is used to handle all payment-related functionality, including:
- Tokenizing credit/debit card information.
- Processing payments securely.
- Managing refunds and payment disputes.
- User adds items to the cart and proceeds to checkout.
- At checkout, user enters payment details.
- Payhero processes the payment and returns a confirmation response.
- Order status is updated based on payment success or failure.
- User Management:
- View all registered users.
- Assign admin roles.
- Product Management:
- Add, edit, and delete products.
- Order Management:
- Update order statuses (e.g., processing, shipped, delivered).
- Dashboard:
- Display key metrics like sales, revenue, and user activity.
-
Use Hostinger or a similar service to deploy the application.
-
For the frontend:
- Build the React app:
npm run build
- Deploy the
buildfolder to your hosting platform.
- Build the React app:
-
For the backend:
- Ensure the backend server is deployed on a Node.js-compatible hosting platform.
- Connect the backend to MongoDB Atlas for a cloud database.
-
Update environment variables in the hosting platform's configuration.
- Fork the repository.
- Create a new branch for your feature:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature-name" - Push the branch and create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
