Skip to content

Kitaab is a single vendor online book selling platform made with NextJS, Express, and MongoDB

Notifications You must be signed in to change notification settings

thebishalniroula/Kitaab-fullstack-bookstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 

Repository files navigation

Project: full stack single seller ecoomerce

This is a full stack single seller ecommerce website that is being built using express js as backend, nextjs as frontend and mongoDB as database.

Backend routes

End-point: user register

Method: POST

/api/auth/user/register

Body (raw)

{
 "name":"Bishal Niroula",
 "email":"bishal@bishal.com",
 "password":"bishal12345"   
}

Response: 200

{
    "status": "success",
    "message": "User regestered."
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: user login

Method: POST

/api/auth/user/login

Body (raw)

{
 "email":"bishal@bishal.com",
 "password":"bishal12345"   
}

Response: 200

{
    "status": "success",
    "message": "You have been logged in as Bishal Niroula"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: user logout

Method: POST

/api/auth/admin/logout

Response: 200

{
    "status": "success",
    "message": "You have been logged out"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: admin login

Method: POST

/api/auth/admin/login

Body (raw)

{

    "email": "niroulabishal199@gmail.com",
    "password":"niroulabishal199"

}

Response: 200

{
    "status": "success",
    "message": "Please verify your otp to login"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: verify-otp

Method: POST

/api/auth/admin/login/verify-otp

Body (raw)

{
    "email": "niroulabishal199@gmail.com",
    "password":"niroulabishal199",
    "otp":"220"
}

Response: 200

{
    "status": "success",
    "message": "You have been logged in as admin."
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: resend-otp

Method: POST

/api/auth/admin/login/resend-otp

Body (raw)

{
    "email" : "niroulabishal199@gmail.com",
    "password":"niroulabishal199"
}

Response: 200

{
    "status": "success",
    "message": "OTP resent successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: admin logout

Method: POST

/api/auth/admin/logout

Response: 200

{
    "status": "success",
    "message": "You have been logged out"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: add book

Method: POST

/api/books/admin/add

Body (raw)

{
    "title":"Title of the book 5", 
    "price":"201",
    "category":"EDUCATIONAL",
    "description" :"This is the description of the book.",
    "stock":"5"
}

Response: 200

{
    "title": "Title of the book 5",
    "price": 201,
    "category": "EDUCATIONAL",
    "description": "This is the description of the book.",
    "image": "/images/books/default.png",
    "stock": 5,
    "_id": "62c72de0d675b843c2dd50af",
    "reviews": [],
    "__v": 0
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: update book

Method: PATCH

/api/books/admin/update/:id

Body (raw)

{
    "price": "250"
}

Response: 200

{
    "_id": "62c6d3fd1fa4dd39f0c58a69",
    "title": "Title of the book 2",
    "price": 250,
    "category": "EDUCATIONAL",
    "description": "This is the description of the book.",
    "image": "/images/books/default.png",
    "stock": 5,
    "reviews": [
        {
            "userId": "62c48d92e348918233fb65a2",
            "review": "Very nice book",
            "_id": "62c6da7344883da20c123f5c"
        }
    ],
    "__v": 0
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: books

Method: GET

/api/books/

Response: 200

[
    {
        "_id": "62c6d3701fa4dd39f0c58a66",
        "title": "Title of the book",
        "price": 200,
        "category": "COMICS",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "stock": 5
    },
    {
        "_id": "62c6d3fd1fa4dd39f0c58a69",
        "title": "Title of the book 2",
        "price": 250,
        "category": "EDUCATIONAL",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "stock": 5
    },
    {
        "_id": "62c6ea460fa77a6bb553d770",
        "title": "Title of the book 3",
        "price": 201,
        "category": "EDUCATIONAL",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "stock": 5
    },
    {
        "_id": "62c6ea9e0fa77a6bb553d774",
        "title": "Title of the book 4",
        "price": 201,
        "category": "EDUCATIONAL",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "stock": 5
    },
    {
        "_id": "62c6eabd0fa77a6bb553d77b",
        "title": "Title of the book 5",
        "price": 201,
        "category": "EDUCATIONAL",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "stock": 5
    },
]

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: book by id

Method: GET

/api/books/:id

Response: 200

{
    "_id": "62c6d3701fa4dd39f0c58a66",
    "title": "Title of the book",
    "price": 200,
    "category": "COMICS",
    "description": "This is the description of the book.",
    "image": "/images/books/default.png",
    "stock": 5,
    "reviews": [],
    "__v": 0
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: books by category

Method: GET

/api/books/category/:category

Response: 200

[
    {
        "_id": "62c6d3fd1fa4dd39f0c58a69",
        "title": "Title of the book 2",
        "price": 250,
        "category": "EDUCATIONAL",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "stock": 5,
        "reviews": [
            {
                "userId": "62c48d92e348918233fb65a2",
                "review": "Very nice book",
                "_id": "62c6da7344883da20c123f5c"
            }
        ],
        "__v": 0
    },
    {
        "_id": "62c6ea9e0fa77a6bb553d774",
        "title": "Title of the book 4",
        "price": 201,
        "category": "EDUCATIONAL",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "reviews": [
            {
                "userId": "62c48d92e348918233fb65a2",
                "review": "Very nice book",
                "_id": "62c6ea9e0fa77a6bb553d775"
            }
        ],
        "stock": 5,
        "__v": 0
    },
    {
        "_id": "62c6eabd0fa77a6bb553d77b",
        "title": "Title of the book 5",
        "price": 201,
        "category": "EDUCATIONAL",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "reviews": [
            {
                "userId": "62c48d92e348918233fb65a2",
                "review": "Very nice book",
                "_id": "62c6eabd0fa77a6bb553d77c"
            }
        ],
        "stock": 5,
        "__v": 0
    },
    {
        "_id": "62c72dc5d675b843c2dd50ab",
        "title": "Title of the book 5",
        "price": 201,
        "category": "EDUCATIONAL",
        "description": "This is the description of the book.",
        "image": "/images/books/default.png",
        "reviews": [
            {
                "userId": "62c48d92e348918233fb65a2",
                "review": "Very nice book",
                "_id": "62c72dc5d675b843c2dd50ac"
            }
        ],
        "stock": 5,
        "__v": 0
    },
]

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: add to cart

Method: POST

/api/cart/add/:id

Response: 200

{
    "status": "success",
    "message": "Item added to cart successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

End-point: remove from cart

Method: DELETE

/api/cart/remove/:id

Response: 200

{
    "status": "success",
    "message": "Item removed from cart successfully"
}

⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃ ⁃

About

Kitaab is a single vendor online book selling platform made with NextJS, Express, and MongoDB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published