Skip to content

phyohtetarkar/marketplace-backend

Repository files navigation

Multi-vendor marketplace backend

Buid Buid (Native)

Multi-vendor e-commerce backend application project developed with Spring boot.

The application business story is like Facebook's pages where users can create their shops and sells products but with subscriptions. After users created their shops, administrator need to approved and users need to subscribe one of plans to start selling products.

Features:

  • Banners
  • Catalog
    • Categories (Multi-level support)
    • Products (Variations support)
  • Orders
  • Shopping cart
  • Favorite products
  • Vendors | Shops
  • Subscription Plans
  • Subscription Promo-codes
  • Reviews
  • Users

Front-end website repository => Multi-vendor marketplace website

Requirement

  1. Java (Java 17 OR Java 21 if you want to enable virtual thread)
  2. PostgreSQL
  3. 2C2P Payment Gateway Credentials
  4. Firebase auth setup

Setup

This project use Firebase auth as authentication layer. So, you first need to setup firebase auth and manually create one owner account. Or you can use any other authentication providers like AWS Cognito, Auth0 etc., and setup accordingly.

I use extra YML config files for different active profiles (e.g, dev, staging, prod). Here is example config for env.development.yml inside /marketplace-application/src/main/resources/

Note

super-user config is required for owner account initialization.

app:
  database:
    url: jdbc:postgresql://localhost:5432/marketplace-db
    username: <username>
    password: <password>
  image:
    base-url: (http|https)://<your-domain>/images
    base-path: <image-base-path> # for storing uploaded image (e.g, /var/www/html/images)
  payment:
    merchant-id: <2c2p-merchant-id>
    merchant-sha-key: <2c2p-merchant-sha-key>
    token-request-url: <2c2p-payment-token-request-url>
  firebase:
    api-key: <firebase-api-key>
    jwk-set-uri: https://www.googleapis.com/service_accounts/v1/jwk/securetoken%40system.gserviceaccount.com
    issuer-uri: https://securetoken.google.com/<projectId>
  super-user:
    name: <owner-name>
    email: <owner-email-address> # The one you created from firebase auth
    uid: <firebase-auth-user-uid> # The one you created from firebase auth
  misc:
    website-url: http://localhost:3000 # for payment redirection
    cors-origins: # cors domains for font-end website
      - http://localhost:3000

Build and run

For JVM build

cd marketplace-backend
./mvnw install && ./mvnw spring-boot:run -pl marketplace-application

For native build

cd marketplace-backend
./mvnw -Pnative clean package

JVM or Native build executable outputs can be found inside /marketplace-application/target/ directory.

Frontend rest apis

This backend produces three main API categories:

  • Admin APIs
  • Vendor APIs
  • Consumer APIs

You can explore api docs via OpenAPI 3 UI path http://localhost:8080/api-docs-ui.

Note

Payment API is only for 2c2p's server-to-server response so that left out from main API categories.

Architecture

Support me



Screenshots