Skip to content

Using Java Spring Boot make RESTful APIs for Ecommerce Shopping Application, Here Used main concept is JWT, Spring Security, Oauth2, Mail, Second Level Cache, MySql DB, Cloudinary and so on

Notifications You must be signed in to change notification settings

BableshAAzad/Ecommerce_Shopping_App-API

Repository files navigation

🏪 Ecommerce Shopping Application API ecommerce.BableshAAzad.com

  • This project is a RESTful web service built using Java Spring Boot.
  • It provides an API for e-commerce shopping applications.
  • The project is based on an Ecommerce Shopping application prototype, implementing basic e-commerce functionalities.

📜 API Documentation:


🏠 Features:

  • Login using Username and Password, providing an Access Token and Refresh Token (AT and RT).
  • Login using OAuth2, supporting login with Google or GitHub.

For Customers:

  • Search, filter, categorize products, view product information, and place orders.
  • Manage the shopping cart, view added products, and proceed with orders.
  • View past orders and download invoices.

For Sellers:

  • Allow sellers to add, update, and delete products.
  • Search warehouses based on proximity to your location to store products.
  • View products and storage information by seller.

🧑‍💻 Technologies Used:

Spring Boot Spring Security RESTful API MySQL Spring Data JPA OpenAPI Documentation Validation OpenPDF Mail OAuth2 Client Google Guava Hateoas Cloudinary WebFlux


💻 How To Use:

🚗 Method 1: Using Online Service

🚐 Method 2: Using Docker

  • Pull the Docker image: bableshaazad/storehousemanagementsystem.
  • Refer to the API documentation for guidance on sending requests and handling responses: ecommerce-shopping-app.
  • Set the necessary environment variables as shown below 👇.

🚒 Method 3: Setting Up Your Own Server

  • Download the master branch as a zip file.
  • Import the project into your IDE and ensure JDK 21 is installed.
  • Set the following environment variables 👇.
  • Refer to the API documentation for guidance on sending requests and handling responses: ecommerce-shopping-app.
  • For swagger documentation http;//localhost:8081/swagger-ui.html

🔐 Environment Variables:

For Database: your DB info

  1. DB_HOST_NAME= localhost
  2. DB_NAME= ecommerce-shopping-application
  3. DB_PASSWORD= root
  4. DB_PORT= 3306
  5. DB_USERNAME= root

For Storehouse-management-system app connection

  1. CLIENT_API_KEY= keyReceivedAtTheTimeOfRegistration
  2. CLIENT_ID= 1
  3. CLIENT_USERNAME= aazad@bableshaazad.org

For Storing Images in Cloud using Cloudinary

  1. CLOUDINARY_API_KEY= 123YourKey
  2. CLOUDINARY_API_SECRET= abcdeYourPassword
  3. CLOUDINARY_CLOUD_NAME= abcdYourName

For GitHub OAuth2 Connection

  1. GITHUB_ID= 12345YourID
  2. GITHUB_SECRET= dummyKey12345

For Google OAuth2 Connection

  1. GOOGLE_ID= YourGoogleIDxyz
  2. GOOGLE_SECRET= googleSecret

Your JWT Secret: Here I am using HS512 code generated at https://8gwifi.org/jwsgen.jsp

  1. JWT_SECRET= jwtSecret1234567890

For Sending Mail during Registration, Purchase Order, and Password Reset

  1. MAIL_PASSWORD= mailPassword
  2. MAIL_USERNAME= yourMail@gmail.com

📝 Examples

  • Find Products:

    Endpoint: GET http://localhost:8080/products?page=0&size=1

Response:

{
    "status": 200,
    "message": "Inventories found",
    "data": {
        "links": [],
        "content": [
            {
                "inventoryId": 1,
                "productTitle": "Chair",
                "lengthInMeters": 0.7,
                "breadthInMeters": 0.8,
                "heightInMeters": 0.8,
                "weightInKg": 8,
                "price": 300,
                "description": "Chair for general use",
                "productImage": "http://res.cloudinary.com/dpaf0bjfx/image/upload/c_fill,h_500,w_500/85010851-aafe-4d8e-9146-69e6b1b5c516",
                "materialTypes": ["WOOD"],
                "restockedAt": "2024-08-27",
                "updatedInventoryAt": null,
                "sellerId": 1,
                "stocks": [
                    {
                        "stockId": 5,
                        "quantity": 10
                    }
                ],
                "discount": 2,
                "discountType": "NEW"
            }
        ],
        "page": {
            "size": 1,
            "totalElements": 12,
            "totalPages": 12,
            "number": 0
        }
    }
}

  • For User Registration Endpoint

Request for register: http://localhost:8080/customers/register

{
  "email" : "bableshaazad@gmail.com",
  "password" : "Test@123!"
}

Submit otp: http://localhost:8080/users/otpVerification

{
  "email" : "bableshaazad@gmail.com",
  "otp" : "888549"
}

Login request: http://localhost:8080/users/otpVerification

{
    "username" : "bableshaazad",
    "password" : "Test@123!"
}

Login response: and at and rt received in header in form of cookies

{
    "status": 200,
    "message": "User Verified",
    "data": {
        "userId": 1,
        "username": "bableshaazad",
        "userRole": "CUSTOMER",
        "accessExpiration": 3600,
        "refreshExpiration": 1296000
    }
}

About

Using Java Spring Boot make RESTful APIs for Ecommerce Shopping Application, Here Used main concept is JWT, Spring Security, Oauth2, Mail, Second Level Cache, MySql DB, Cloudinary and so on

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published