node-express-typescript-ecommerce-rest-api
Saddam-rest-api
Free Open source REST API built with | Nodejs + Express + Mongodb ⚡️ Made with developer experience first Prettier + VSCode setup.
- C.R.U.D, Filter, Paginate, Sort and Search API
Table of contents
- Author
- Demo
- Technologies
- Contributing
- Status
- Features
- Related Projects
- Support
- Feedback
- Run Locally
- API Reference
- Screenshots
- Environment Variables
- Deployment
Author
Technologies
- Node.js
- Express
- MongoDB
- JSON Web Token (JWT)
- bcryptjs
- Heroku Hosting
Demo
LIVE API Demo
LIVE Webside DEMO
Testing Password: 12345test
Features
(Users)
- Complete user authentication
- Users can sign in
- Users can sign out
- Users can verify email
- Users can Change Password
- View all products
- View products detail
- Filter products by category
- Search for products
- Add products to their basket
- Checkout total payment
- Checkout order page
- Products pagination
(Admin)
- Complete Admin Authorization
- Add products
- Update products
- Delete products
- Limit Products
- Add Users
- Update Users
- Delete Users
- Update User Role
API_Reference
Get all products
GET https://saddam-rest-api.herokuapp.com/api/v1/products
Parameter
Type
Description
limit
number
default= 100
category
string
default= All Products
page
number
default= 1
search
string
search string
sortBy
string
default= createdAt
OrderBy
string
default= desc
example (Paginate – Sort – Filter – Full-text search
GET https://saddam-rest-api.herokuapp.com/api/v1/products?page=1&limit=99&sortBy=createdAt&OrderBy=desc&filterBy=category&category=Sports GET https://saddam-rest-api.herokuapp.com/api/v1/products?page=2&limit=99&sortBy=createdAt&OrderBy=desc&filterBy=category&category=Jewelery GET https://saddam-rest-api.herokuapp.com/api/v1/products?page=2&limit=99&sortBy=createdAt&OrderBy=desc&filterBy=category&category=Books&search=nodejs
Get single product
GET https://saddam-rest-api.herokuapp.com/api/v1/products/${id}
Parameter
Type
Description
id
string
Required. Id of product to fetch
Add new product (Only admins)
POST https://saddam-rest-api.herokuapp.com/api/v1/admin/products
Parameter
Type
Description
name
string
Required. product name
price
number
Required. product price
description
string
Required. product description
productImage
img
Required. product Image
category
string
Required. product category
count
number
Optional. default value = 1
stock
string
Optional. default value=”in stock – order soon”
Update product (Only admins)
PATCH https://saddam-rest-api.herokuapp.com/api/v1/admin/products/${id}
Parameter
Type
Description
id
string
Required. Id of product to update
token
string
Required. JWT token pass in headers
Delete product (Only admins)
DELETE https://saddam-rest-api.herokuapp.com/api/v1/admin/products/${id}
Parameter
Type
Description
id
string
Required. Id of product to delete
token
string
Required. JWT token pass in headers
User signup
POST https://saddam-rest-api.herokuapp.com/api/v1/auth/signup
Parameter
Type
Description
firstName
string
Required.
lastName
string
Required.
familyName
string
Optional.
email
string
Required.
password
string
Required.
confirmPassword
string
Required.
gender
string
Optional.
dateOfBirth
string
Optional.
acceptTerms
boolean
Required.
mobileNumber
number
Optional.
nationality
string
Optional.
favoriteAnimal
string
Optional.
address
string
Optional.
bio
string
Optional.
jobTitle
string
Optional.
After signup you will receive email to verify your account
User Login
POST https://saddam-rest-api.herokuapp.com/api/v1/auth/login
Parameter
Type
Description
email
string
Required.
password
string
Required.
User Verify Email
POST https://saddam-rest-api.herokuapp.com/api/v1/auth/verify-email`,
Parameter
Type
Description
userId
string
Required.
token
string
Required.
Environment
- To run this project, you will need to add the following environment variables to your .env file (check environment.config.js file for more examples)
- MONGODB_CONNECTION_STRING
- TOKEN_SECRET
- WEBSITE_URL
- API_VERSION =”v1″
- JWT_EXPIRE_TIME
- SEND_GRID_API_KEY
- ADMIN_SEND_GRID_EMAIL
- ADMIN_ROLE
- ADMIN_EMAIL
- NODE_ENV = ‘development’
- CLIENT_URL
- ACCESS_TOKEN_SECRET_KEY
- REFRESH_TOKEN_SECRET_KEY
- ACCESS_TOKEN_KEY_EXPIRE_TIME
- REFRESH_TOKEN_KEY_EXPIRE_TIME
Contributing
Contributions are always welcome!
Deployment
To deploy this project on Heroku Flow the Flowing documentation Deploying Node.js Apps on Heroku
Related_Projects
Blog API built with | Nodejs + Express + Mongodb
LIVE API
LIVE Webside DEMO
Twitter API built with | Nodejs + Express + Mongodb
LIVE API Demo
LIVE Webside DEMO
Netflix API built with | Nodejs + Express + Mongodb
LIVE API Demo
Support
For support, email saddamarbaas@gmail.com.
Feedback
If you have any feedback, please reach out to me at
saddamarbaas@gmail.com
Twitter
https://twitter.com/ArbaaSaddam/
Linkedin.
https://www.linkedin.com/in/saddamarbaa/
Github
https://github.com/saddamarbaa
Instagram
https://www.instagram.com/saddam.dev/
Facebook
https://www.facebook.com/saddam.arbaa
Run_Locally
Clone the project
https://github.com/saddamarbaa/node-express-rest-api
Go to the project directory
cd node-express-rest-api
Install dependencies
yarn install # or npm install
Start the server
node app.js or nodemon app.js
Status
Project is: in progress I’m working on it in my free time