Welcome to the Shopsphere Backend repository! This project serves as the backend for the Shopsphere e-commerce platform, providing essential APIs and functionalities for managing the online store.
- User authentication and authorization
- Product management (CRUD operations)
- Shopping cart management
- Order processing
- Payment integration
- Admin dashboard for managing the platform
To get started with the Shopsphere backend, follow these steps:
-
Clone the repository:
git clone https://github.com/anshul9809/shopsphere.git cd shopsphere/backend
-
Install dependencies:
Make sure you have Node.js and npm installed. Then run:
npm install
-
Set up environment variables:
Create a
.env
file in the root directory and add the following environment variables:PORT=5000 MONGO_URL=your_mongodb_uri JWT_SECRET=your_jwt_secret GMAIL_EMAIL = your_gmail_email GMAIL_PASSWORD = your_gmail_password CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret
-
Run the server:
npm start
The backend server will start on the port specified in the
.env
file (default is 5000).
Configure the application by editing the environment variables in the .env
file. Ensure you have all the required values set up correctly.
After setting up and running the server, you can interact with the API using tools like Postman or directly through your frontend application.
Here are some of the main API endpoints available in the Shopsphere backend:
-
User Authentication:
POST /api/v1/users/register
- Register a new userPOST /api/v1/users/login
- Log in a user
-
Product Management:
GET /api/v1/products
- Get all productsGET /api/v1/products/:id
- Get a single product by IDPOST /api/v1/products
- Create a new product (admin only)PUT /api/v1/products/:id
- Update a product (admin only)DELETE /api/v1/products/:id
- Delete a product (admin only)
-
Cart Management:
GET /api/v1/cart
- Get the user's cartPOST /api/v1/cart
- Add items to the cartDELETE /api/v1/cart/:id
- Remove items from the cart
-
Order Processing:
POST /api/v1/orders
- Create a new orderGET /api/v1/orders/:id
- Get order details by ID
- Node.js
- Express.js
- MongoDB
- JWT for authentication
- Cloudinary for image upload
- Nodemailer
Contributions are welcome! Please fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for details.