How to Setup and Run the Project
Prerequisites
-
Install Node.js:
- Download and install Node.js from the official website: https://nodejs.org/en/download/
- Verify installation:
-
Install Git:
- Ensure Git is installed on your system: https://git-scm.com/
-
MongoDB and Stripe:
- Set up a MongoDB database and Stripe account for payment processing.
Steps to Run the Backend
- Open the project folder in VS Code or any code editor.
- Navigate to the
backend
folder:
- Install dependencies:
- Configure the
.env
file:
- Add the following variables to the
backend/.env
file:
MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/<dbname>
STRIPE_SECRET_KEY=your_stripe_secret_key
PORT=5000
- Replace
<username>
, <password>
, and <dbname>
with your MongoDB credentials.
- Add your Stripe secret key.
- Start the backend server:
- The backend will run at
http://localhost:5000
.
Steps to Run the Frontend
- Navigate to the
frontend
folder:
- Install dependencies:
- Start the frontend:
- Open the application:
- The frontend will run at
http://localhost:5173
. Open this link in your browser.
Steps to Run the Admin Panel
- Navigate to the
admin
folder:
- Install dependencies:
- Start the admin panel:
- Open the admin panel:
- The admin panel will run at
http://localhost:5174
. Open this link in your browser.
Notes
- Ensure the backend server is running before starting the frontend or admin panel.
- Database Setup:
- MongoDB must be running, and your database should have the appropriate collections (
users
, products
, orders
).
- Stripe Payments:
- Payments will only work if Stripe is correctly configured in the
.env
file.
- Environment Variables:
- Ensure all required variables are correctly set in the respective
.env
files.
Troubleshooting
- If you encounter any issues, check the terminal logs for errors.
- Ensure Node.js and MongoDB are correctly installed and running.
- Clear the browser cache if the frontend or admin panel fails to load.
For further assistance, feel free to reach out!