https://github.com/fisayo-dev/shopping_app_api
A web Api for a shopping app built with Node.js and Express
https://github.com/fisayo-dev/shopping_app_api
express mongodb nodejs
Last synced: 3 months ago
JSON representation
A web Api for a shopping app built with Node.js and Express
- Host: GitHub
- URL: https://github.com/fisayo-dev/shopping_app_api
- Owner: fisayo-dev
- Created: 2025-03-07T23:49:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-21T20:35:47.000Z (over 1 year ago)
- Last Synced: 2025-03-21T21:27:42.887Z (over 1 year ago)
- Topics: express, mongodb, nodejs
- Language: JavaScript
- Homepage:
- Size: 73.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🛍️ Shopping App API
A robust and scalable API for a shopping application, built using **Node.js** and **MongoDB**. This API provides essential functionalities for managing products, user authentication, orders, payments, carts and more.
## 🚀 Features
- **User Authentication** (JWT-based login & signup)
- **Product Management** (CRUD operations)
- **Admin Control & Access**
- **Cart & Order Management**
- **Payment Integration (coming soon)** (Stripe, Flutterwave, or preferred gateway)
- **Wishlist & Favorites (coming soon)**
- **Secure & Optimized API Endpoints**
## 🏗️ Tech Stack
- **Backend:** Node.js, Express.js
- **Database:** MongoDB (Mongoose ORM)
- **Authentication:** JSON Web Tokens (JWT)
- **Payments:** Stripe / PayStack
- **API Documentation:** Swagger / Postman
- **API Agent:** HTTPie / Any other alternative
## 📦 Installation
1. Clone the repository:
```bash
git clone https://github.com/fisayo-dev/shopping-app-api.git
cd shopping-app-api
2. Clone the repository:
```bash
npm install
3. Set up environment variables:
Create a .env file and add the following:
```env
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
STRIPE_SECRET=your_stripe_secret_key
4. Start Server
- __Local__:
```bash
npm start
- __Development__:
```bash
npm run dev #uses nodemom
## 📌 API Endpoints
| Method | Endpoint | Description |
|--------|----------------------|--------------------------------|
| POST | `/api/v1/admin/sign-up` | Register a new admin |
| POST | `/api/v1/admin/sign-in` | Authenticate admin |
| POST | `/api/v1/auth/sign-up` | Register a new user |
| POST | `/api/v1/auth/sign-in` | Authenticate user |
| GET | `/api/v1/users/` | Get all Users (admin only) |
| GET | `/api/v1/users/:id` | Get user details |
| PUT | `/api/v1/users/:id` | Edit user details |
| DELETE | `/api/v1/users/:id` | Delete user |
| GET | `/api/v1/products` | Fetch all products |
| POST | `/api/v1/products` | Add 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) |
| GET | `/api/v1/orders/my-orders` | Fetch all orders |
| POST | `/api/v1/orders/make` | Add a new order |
| GET | `/api/v1/carts` | Get items in cart |
| POST | `/api/v1/carts` | Create an item in cart |
| PUT | `/api/v1/carts` | Update cart quantity |
| DELETE | `/api/v1/carts/clear` | Clear all item in cart |
| DELETE | `/api/v1/carts/remove/:id` | Delete specific item in cart |
| GET | `/api/v1/category` | Get all categories |
| POST | `/api/v1/category` | Create a new category |
| PUT | `/api/v1/category/:id` | Update category text |
| DELETE | `/api/v1/category/:id` | Delete a category item |
## 🔐 Authentication
This API uses JWT authentication. After logging in, users receive a token, which they must include in requests requiring authentication.
Example request with JWT token:
```http
GET /api/v1/carts
Authorization: Bearer your_jwt_token
## 💳 Payments
The API supports payment processing via Paystack or Flutterwave. Ensure you configure your API keys correctly in the .env file.
## 📝 Contributions
Contributions are welcome! Feel free to fork this repo, submit issues, or create pull requests.
## 📄 License
This project is licensed under the MIT License.
```sql
Copy and paste this into your `README.md` file. Let me know if you need any modifications! 🚀