Skip to content

Repository files navigation

E-Commerce Backend API

Spring Boot e-commerce backend with payment integration.

Quick Start

Option 1: Use Start Scripts (Recommended)

Windows:

# PowerShell
.\start.ps1

# Or Batch file
start.bat

Linux/Mac:

chmod +x start.sh
./start.sh

This will automatically:

  1. Start MongoDB (Docker)
  2. Start E-Commerce API (Port 8080)
  3. Start Mock Payment Service (Port 8081)

Option 2: Manual Setup

  1. Start MongoDB using Docker:

    docker-compose up -d

    Or install MongoDB locally and start it on port 27017

  2. Build and run main application:

    mvn clean install
    mvn spring-boot:run
  3. Build and run mock payment service (in separate terminal):

    cd mock-payment-service
    mvn clean install
    mvn spring-boot:run

Stop Services

Windows:

.\stop.ps1

Linux/Mac:

./stop.sh

Note: Spring Boot applications need to be stopped manually in their terminal windows (Ctrl+C)

APIs

Products

  • POST /api/products - Create product
  • GET /api/products - Get all products

Cart

  • POST /api/cart/add - Add item to cart
  • GET /api/cart/{userId} - Get user cart
  • DELETE /api/cart/{userId}/clear - Clear cart

Orders

  • POST /api/orders - Create order from cart
  • GET /api/orders/{orderId} - Get order details

Payments

  • POST /api/payments/create - Create payment

Webhooks

  • POST /api/webhooks/payment - Payment webhook endpoint

Testing Flow

  1. Create products: POST /api/products
  2. Add to cart: POST /api/cart/add
  3. Create order: POST /api/orders
  4. Create payment: POST /api/payments/create
  5. Wait 3 seconds for webhook
  6. Check order status: GET /api/orders/{orderId}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages