A mobile friendly, production ready and fully featured e-commerce website.
For full documentaiton try to import this collection into your postman
Update user info by the admin
Description: Update user account
Access: Private/Admin
type body = {
firstName?: string;
lastName?: string;
email?: string;
isAmdin?: boolean;
};
{
"isAdmin": true
}
{
"_id": "6326a3633979c3a722be8411",
"firstName": "Jane",
"lastName": "Doe",
"email": "[email protected]",
"isAdmin": true
}
Description: Get all users
Access: Private/Admin
Authorization: Bearer <TOKEN>
{
"users": [
{
"_id": "6326a3633979c3a722be8411",
"firstName": "Jane",
"lastName": "Doe",
"email": "[email protected]",
"password": "$2a$10$eajsr5X/E3D2B8N8anLa8O3LlF7Sj/sCquBs2xPH.n7wXBai4viI2",
"isAdmin": false,
"createdAt": "2022-09-18T04:49:39.687Z",
"updatedAt": "2022-09-18T04:49:39.687Z",
"__v": 0
},
{
"_id": "6326a4fda8012c4bc02d6368",
"firstName": "Jone",
"lastName": "Doe",
"email": "[email protected]",
"password": "$2a$10$wKNngaZrvxMsTRQajNfzjekiLhTSZRSdAWdWkrJ1U3D8gCE9nQoZ2",
"isAdmin": true,
"createdAt": "2022-09-18T04:56:29.313Z",
"updatedAt": "2022-09-18T05:29:13.020Z",
"__v": 0
}
],
"count": 2
}
Description: Delete a user by id
Access: Private/Admin
Authorization: Bearer <TOKEN>
{
"message": "User removed"
}
Description: Delete user account by the user itself
Access: Private/user
Authorization: Bearer <TOKEN>
{
"message": "User removed"
}
Description: Get user by Id
Access: Private/Admin
Authorization: Bearer <TOKEN>
{
"_id": "6326a3633979c3a722be8411",
"firstName": "Jane",
"lastName": "Doe",
"email": "[email protected]",
"isAdmin": false,
"createdAt": "2022-09-18T04:49:39.687Z",
"updatedAt": "2022-09-18T04:49:39.687Z",
"__v": 0
}
Description: Authorize user for login
Access: Public
type Body = {
email: string;
password: string;
};
{
"email": "[email protected]",
"password": "1234567"
}
{
"_id": "6326a4fda8012c4bc02d6368",
"firstName": "Jone",
"lastName": "Doe",
"email": "[email protected]",
"isAdmin": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzMjZhNGZkYTgwMTJjNGJjMDJkNjM2OCIsImlhdCI6MTY2MzQ4MDk4NCwiZXhwIjoxNjY2MDcyOTg0fQ.rv7FZMh_ScxkdvYHfBC03cEajFuViXoEtwN74FYmkRQ"
}
Description: Register a new user
Access: Public
{
"firstName": "Joen",
"lastName": "Doe",
"email": "[email protected]",
"password": "1234567"
}
{
"_id": "633d4c6abd2e35a18c53e777",
"firstName": "Joen",
"lastName": "Doe",
"email": "[email protected]",
"isAdmin": false,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzM2Q0YzZhYmQyZTM1YTE4YzUzZTc3NyIsImlhdCI6MTY2NDk2MTY0MiwiZXhwIjoxNjY3NTUzNjQyfQ.OgnvSKOiyoCziTcU9q6yElFpd0REM2BBuP6L53Loz8Q"
}
Description: Get user account
Access: Private/user
Authorization: Bearer <TOKEN>
{
"_id": "6326a4fda8012c4bc02d6368",
"firstName": "Joen",
"lastName": "Doe",
"email": "[email protected]",
"isAdmin": false,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzMjZhNGZkYTgwMTJjNGJjMDJkNjM2OCIsImlhdCI6MTY2MzQ3Njk4OSwiZXhwIjoxNjY2MDY4OTg5fQ.wxPGnDLvZYqyXXC5YIaUJoJqfxdeZlb96xi4Jvgtj80"
}
Description: Update user account
Access: Private/user
Authorization: Bearer <TOKEN>
{
"_id": "6326a4fda8012c4bc02d6368",
"firstName": "Jone",
"lastName": "Doe",
"email": "[email protected]",
"isAdmin": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzMjZhNGZkYTgwMTJjNGJjMDJkNjM2OCIsImlhdCI6MTY2MzQ3ODk1MywiZXhwIjoxNjY2MDcwOTUzfQ.5KCy_rocdxUDcLRVEgJdcJmAHKfP4gIOWEy9Mra4V6M"
}
Description: An endpoint to send an email to user incase he forget the password
Access: Public
Authorization: Bearer <TOKEN>
{
"success": true,
"data": "Email sent"
}
Description: UUpdate a product by id
Access: Private/Admin
{
"price": 1200.0,
"images": ["img_3.png", "img_4.png"]
}
{
"_id": "6327fa179b841ab4ec957660",
"user": "6326a4fda8012c4bc02d6368",
"name": "iPhone 13 pro max",
"images": ["img_1.png", "img_3.png", "img_4.png"],
"brand": "Apple",
"category": [],
"description": "The most powerful phone on the planet earth",
"rating": 0,
"numReviews": 0,
"discount": 2,
"price": 1200,
"countInStock": 2000,
"reviews": [],
"createdAt": "2022-09-19T05:11:51.150Z",
"updatedAt": "2022-09-19T05:20:08.235Z",
"__v": 1
}
Description: Create new product
Access: Private/Admin
{
"name": "iPhone 13 pro max",
"images": ["img_1.png"],
"brand": "Apple",
"caregory": ["phones"],
"description": "The most powerful phone on the planet earth",
"discount": 2,
"price": 1000.0,
"countInStock": 2000
}
{
"user": "6326a4fda8012c4bc02d6368",
"name": "iPhone 13 pro max",
"images": ["img_1.png"],
"brand": "Apple",
"category": [],
"description": "The most powerful phone on the planet earth",
"rating": 0,
"numReviews": 0,
"discount": 2,
"price": 1000,
"countInStock": 2000,
"_id": "6327fa179b841ab4ec957660",
"reviews": [],
"createdAt": "2022-09-19T05:11:51.150Z",
"updatedAt": "2022-09-19T05:11:51.150Z",
"__v": 0
}
Description: Delete a product by ID
Access: Private/Admin
Authorization: Bearer <TOKEN>
{
"messages": "Product Removed"
}
Description: Get all products
Access: Public
{
"success": true,
"count": 2,
"products": [
{
"_id": "6327fa179b841ab4ec957660",
"user": "6326a4fda8012c4bc02d6368",
"name": "iPhone 13 pro max",
"images": ["img_1.png"],
"brand": "Apple",
"category": [],
"description": "The most powerful phone on the planet earth",
"rating": 0,
"numReviews": 0,
"discount": 2,
"price": 1000,
"countInStock": 2000,
"reviews": [],
"createdAt": "2022-09-19T05:11:51.150Z",
"updatedAt": "2022-09-19T05:11:51.150Z",
"__v": 0
},
{
"_id": "6327dea49a70962f67219b8e",
"user": "6326a4fda8012c4bc02d6368",
"name": "iPhone 13 pro max",
"images": [
"img_1.png",
"img_2.png",
"img_3.png",
"img_3.png",
"img_4.png"
],
"brand": "Apple",
"category": [],
"description": "The most powerful phone on the planet earth",
"rating": 0,
"numReviews": 0,
"discount": 2,
"price": 1200,
"countInStock": 2000,
"reviews": [],
"createdAt": "2022-09-19T03:14:44.403Z",
"updatedAt": "2022-09-19T03:59:29.317Z",
"__v": 7
}
]
}
Description: Get product by id
Access: Public
{
"_id": "6327fa179b841ab4ec957660",
"user": "6326a4fda8012c4bc02d6368",
"name": "iPhone 13 pro max",
"images": ["img_1.png"],
"brand": "Apple",
"category": [],
"description": "The most powerful phone on the planet earth",
"rating": 0,
"numReviews": 0,
"discount": 2,
"price": 1000,
"countInStock": 2000,
"reviews": [],
"createdAt": "2022-09-19T05:11:51.150Z",
"updatedAt": "2022-09-19T05:11:51.150Z",
"__v": 0
}
Description: Get top rated products
Access: Public
[
{
"_id": "6327fa179b841ab4ec957660",
"user": "6326a4fda8012c4bc02d6368",
"name": "iPhone 13 pro max",
"images": ["img_1.png", "img_3.png", "img_4.png"],
"brand": "Apple",
"category": [],
"description": "The most powerful phone on the planet earth",
"rating": 0,
"numReviews": 0,
"discount": 2,
"price": 1200,
"countInStock": 2000,
"reviews": [],
"createdAt": "2022-09-19T05:11:51.150Z",
"updatedAt": "2022-09-19T05:20:08.235Z",
"__v": 1
}
]
Description: Get new published products
Access: Public
[
{
"_id": "6327fa179b841ab4ec957660",
"user": "6326a4fda8012c4bc02d6368",
"name": "iPhone 13 pro max",
"images": ["img_1.png", "img_3.png", "img_4.png"],
"brand": "Apple",
"category": [],
"description": "The most powerful phone on the planet earth",
"rating": 0,
"numReviews": 0,
"discount": 2,
"price": 1200,
"countInStock": 2000,
"reviews": [],
"createdAt": "2022-09-19T05:11:51.150Z",
"updatedAt": "2022-09-19T05:20:08.235Z",
"__v": 1
}
]
Description: Add product review
Access: Private/user
{
"rating": 5,
"comment": "Very cool!"
}
{
"message": "Review added"
}
Description: Update product review by the user
Access: Private/user
{
"comment": "Super cool!"
}
{
"message": "Review Updated"
}
Description: Delete product review by the user
Access: Private/user
{
"message": "Review Deleted"
}
Description: Delete product review by the admin
Access: Private/admin
{
"message": "Review Removed"
}
Description: Create new order
Access: Private/user
{
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200.0,
"product": "6327dea49a70962f67219b8e"
}
],
"shippingMethod": {
"name": "internation shipping",
"cost": 20.0
},
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": 1234,
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"paymentMethod": "PAYPAL",
"txPrice": 200.0,
"shippingPrice": 250.0,
"totalPrice": 450.0
}
{
"user": "6326a4fda8012c4bc02d6368",
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200,
"product": "6327dea49a70962f67219b8e",
"_id": "632814179b841ab4ec957692"
}
],
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"paymentMethod": "PAYPAL",
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": false,
"isDelivered": false,
"_id": "632814179b841ab4ec957691",
"createdAt": "2022-09-19T07:02:47.399Z",
"updatedAt": "2022-09-19T07:02:47.399Z",
"__v": 0
}
Description: Get order by id
Access: Private/user
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"paymentResult": {
"id": "6327f1aebc834eab1742347a",
"status": "success",
"update_time": "9/19/20222 6:54 am",
"email_address": "[email protected]"
},
"_id": "6327f1aebc834eab1742347a",
"user": {
"_id": "6326a4fda8012c4bc02d6368",
"email": "[email protected]"
},
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200,
"product": "6327dea49a70962f67219b8e",
"_id": "6327f1aebc834eab1742347b"
}
],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": true,
"isDelivered": true,
"createdAt": "2022-09-19T04:35:58.585Z",
"updatedAt": "2022-09-19T04:57:19.635Z",
"__v": 0,
"paidAt": "2022-09-19T04:55:03.472Z",
"deliveredAt": "2022-09-19T04:57:19.629Z"
}
Description: Pay an order
Access: Private/user
{
"id": "6327f1aebc834eab1742347a",
"status": "success",
"update_time": "9/19/20222 6:54 am",
"payer": {
"email_address": "[email protected]"
}
}
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"paymentResult": {
"id": "6327f1aebc834eab1742347a",
"status": "success",
"update_time": "9/19/20222 6:54 am",
"email_address": "[email protected]"
},
"_id": "6327f1aebc834eab1742347a",
"user": "6326a4fda8012c4bc02d6368",
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200,
"product": "6327dea49a70962f67219b8e",
"_id": "6327f1aebc834eab1742347b"
}
],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": true,
"isDelivered": true,
"createdAt": "2022-09-19T04:35:58.585Z",
"updatedAt": "2022-09-19T07:06:27.877Z",
"__v": 0,
"paidAt": "2022-09-19T07:06:27.873Z",
"deliveredAt": "2022-09-19T04:57:19.629Z"
}
Description: Set an order to be delivered
Access: Private/admin
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"paymentResult": {
"id": "6327f1aebc834eab1742347a",
"status": "success",
"update_time": "9/19/20222 6:54 am",
"email_address": "[email protected]"
},
"_id": "6327f1aebc834eab1742347a",
"user": "6326a4fda8012c4bc02d6368",
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200,
"product": "6327dea49a70962f67219b8e",
"_id": "6327f1aebc834eab1742347b"
}
],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": true,
"isDelivered": true,
"createdAt": "2022-09-19T04:35:58.585Z",
"updatedAt": "2022-09-19T07:07:33.406Z",
"__v": 0,
"paidAt": "2022-09-19T07:06:27.873Z",
"deliveredAt": "2022-09-19T07:07:33.405Z"
}
Description: Get user orders
Access: Private/user
[
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"_id": "6327f0ca1ad2cab4387e6024",
"user": "6326a4fda8012c4bc02d6368",
"orderItems": [],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": false,
"isDelivered": false,
"createdAt": "2022-09-19T04:32:10.723Z",
"updatedAt": "2022-09-19T04:32:10.723Z",
"__v": 0
},
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"paymentResult": {
"id": "6327f1aebc834eab1742347a",
"status": "success",
"update_time": "9/19/20222 6:54 am",
"email_address": "[email protected]"
},
"_id": "6327f1aebc834eab1742347a",
"user": "6326a4fda8012c4bc02d6368",
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200,
"product": "6327dea49a70962f67219b8e",
"_id": "6327f1aebc834eab1742347b"
}
],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": true,
"isDelivered": true,
"createdAt": "2022-09-19T04:35:58.585Z",
"updatedAt": "2022-09-19T07:07:33.406Z",
"__v": 0,
"paidAt": "2022-09-19T07:06:27.873Z",
"deliveredAt": "2022-09-19T07:07:33.405Z"
},
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"_id": "632814179b841ab4ec957691",
"user": "6326a4fda8012c4bc02d6368",
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200,
"product": "6327dea49a70962f67219b8e",
"_id": "632814179b841ab4ec957692"
}
],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": false,
"isDelivered": false,
"createdAt": "2022-09-19T07:02:47.399Z",
"updatedAt": "2022-09-19T07:02:47.399Z",
"__v": 0
}
]
Description: Get all orders
Access: Private/admin
{
"success": true,
"count": 3,
"orders": [
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"_id": "6327f0ca1ad2cab4387e6024",
"user": {
"_id": "6326a4fda8012c4bc02d6368"
},
"orderItems": [],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": false,
"isDelivered": false,
"createdAt": "2022-09-19T04:32:10.723Z",
"updatedAt": "2022-09-19T04:32:10.723Z",
"__v": 0
},
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"paymentResult": {
"id": "6327f1aebc834eab1742347a",
"status": "success",
"update_time": "9/19/20222 6:54 am",
"email_address": "[email protected]"
},
"_id": "6327f1aebc834eab1742347a",
"user": {
"_id": "6326a4fda8012c4bc02d6368"
},
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200,
"product": "6327dea49a70962f67219b8e",
"_id": "6327f1aebc834eab1742347b"
}
],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": true,
"isDelivered": true,
"createdAt": "2022-09-19T04:35:58.585Z",
"updatedAt": "2022-09-19T07:07:33.406Z",
"__v": 0,
"paidAt": "2022-09-19T07:06:27.873Z",
"deliveredAt": "2022-09-19T07:07:33.405Z"
},
{
"shippingAddress": {
"address": "some address",
"city": "New York",
"postalCode": "1234",
"country": "US",
"apartment": "apartment",
"firstName": "Jone",
"lastName": "Doe"
},
"shippingMethod": {
"name": "internation shipping",
"cost": 20
},
"_id": "632814179b841ab4ec957691",
"user": {
"_id": "6326a4fda8012c4bc02d6368"
},
"orderItems": [
{
"name": "iPhone 13 pro max",
"qty": 1,
"image": "img.png",
"price": 1200,
"product": "6327dea49a70962f67219b8e",
"_id": "632814179b841ab4ec957692"
}
],
"paymentMethod": "PAYPAL",
"taxPrice": 0,
"shippingPrice": 250,
"totalPrice": 450,
"isPaid": false,
"isDelivered": false,
"createdAt": "2022-09-19T07:02:47.399Z",
"updatedAt": "2022-09-19T07:02:47.399Z",
"__v": 0
}
]
}
type User = {
firstName: string;
lastName: string;
email: string;
password: string;
isAdmin: boolean;
resetPasswordToken: string;
resetPasswordExpire: string;
createAt: Date;
updatedAt: Date;
};
type Product = {
user: User;
name: string;
images: string[];
brand: string;
category: string[];
description: string;
reviews: Reviews[];
rating: number;
numReviews: number;
discount: number;
price: number;
countInStock: number;
createdAt: Date;
updatedAt: Date;
};
type Reivew = {
name: string;
rating: number;
comment: string;
user: User;
createdAt: Date;
updatedAt: Date;
};
type OrderItem = {
name: string;
qty: number;
image: string;
price: number;
product: Product;
};
type Order = {
user: User;
orderItems: OrderItem[];
shippingAddress: {
address: string;
city: string;
postalCode: string;
country: string;
apartment: string;
firstName: string;
lastName: string;
};
paymentMethod: string;
shippingMethod: {
name: string;
cost: string;
};
paymentResult: {
id: string;
status: string;
update_time: Date;
email_address: string;
};
taxPrice: number;
shippingPrice: number;
totalPrice: number;
isPaid: boolean;
paidAt: Date;
isDelivered: boolean;
deliveredAt: Date;
createdAt: Date;
updatedAt: Date;
};