AdventureAlly is an e-commerce website backend built using Node.js and MongoDB. It provides endpoints for user authentication, product management, and shopping cart functionality.
- User Authentication: Users can sign up and sign in securely using JWT tokens.
- Role-based Access Control: Supports roles for users (user, admin) with different access permissions.
- Product Management: CRUD operations for managing products, including creation, update, deletion, and retrieval.
- Shopping Cart: Users can add products to their cart, view their cart, and manage cart items.
- Additional Features: Includes features like getting random products, best-selling products, etc.
To get started with AdventureAlly, follow these steps:
-
Clone the repository:
git clone https://github.com/Muslehud77/AdventureAlly-Server.git cd AdventureAlly-Server -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the root directory and add the following:NODE_ENV=development PORT=5000 DATABASE_URI=mongodb://localhost:27017/adventureally_db HASH_SALT=12 DEFAULT_PASS=your_default_password JWT_ACCESS_SECRET=your_access_secret_key JWT_REFRESH_SECRET=your_refresh_secret_key JWT_ACCESS_EXPIRES_IN=7d JWT_REFRESH_EXPIRES_IN=30d
-
Start the server:
npm run start:dev
-
Use API endpoints as described in the documentation.
- POST /signup: Create a new user account.
- POST /signin: Authenticate and obtain JWT tokens.
- POST /refreshToken: Refresh the access token.
- POST /api/products: Create a new product (Admin only).
- GET /api/products: Get all products.
- GET /api/products/:id: Get a product by ID.
- PATCH /api/products/:id: Update a product (Admin only).
- DELETE /api/products/:id: Delete a product (Admin only).
- POST /api/carts: Add a product to the shopping cart (User only).
- GET /api/my-cart: View items in the user's shopping cart.
- GET /api/best-selling: Get best-selling products.
- GET /api/random-products: Get random products.
Note: This is not an exhaustive list of all available APIs. There are many more endpoints to explore and use in the project.
Contributions are welcome! Please fork the repository and create a pull request with your improvements.
For the client-side of this project, visit the following links:
To set up the client-side of AdventureAlly, follow these steps:
-
Clone the client repository:
git clone https://github.com/Muslehud77/AdventureAlly-client.git cd AdventureAlly-client -
Install dependencies:
npm install
If you encounter issues, use the following command:
npm install --force
-
Set up environment variables: Create a
.env.localfile in the root directory and add the following:VITE_IMAGEBB_API=your_imagebb_api_key VITE_BASE_URL=http://localhost:5000/api
-
Start the development server:
npm run dev
Thank you for checking out AdventureAlly! If you have any questions or feedback, feel free to reach out.