Skip to content

mochacr0/mongodb-shop-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MongoDB-Shop-Backend

An e-commerce backend application using Spring Boot, leveraging AWS S3 for media storage, Giaohangtietkiem for delivery services, and integrating Momo wallet for seamless payment processing.

Technologies

  • Java 17
  • Spring Boot 3.1.0
  • Spring Security
  • Spring JPA
  • MongoDB
  • OAuth

Testing

Requirements

  • Any IDE of your choice
  • Docker

Step-by-step Guide

  1. Clone the latest code:
git clone https://github.com/mochacr0/mongodb-shop-backend.git
  1. Open your preferred IDE and provide your own application.yml file, including application properties, secrets, and API keys:
spring:
  data:
    mongodb:
      uri: <YOUR MONGODB CONNECTION STRING>
      auto-index-creation: true
  cloud:
    aws:
      credentials:
        access-key: <YOUR AWS ACCESS KEY>
        secret-key: <YOUR AWS SECRET KEY>
      region:
        static: <YOUR PREFERRED DATA STORAGE REGION>
server:
  port: 5000
  servlet:
    encoding:
      charset: UTF-8
      force: true
jwt:
  settings:
    accessTokenExpiryTimeSeconds: 1800
    refreshTokenExpiryTimeSeconds: 2592000
    tokenSigningKeyString: <YOUR 256-BIT JWT TOKEN SIGNING KEY>
    tokenIssuer: localhost #Token issuer
logging:
  level:
    org:
      springframework:
        security: TRACE
        data:
          mongodb:
            core:
              MongoTemplate: DEBUG
security:
  oauth2:
    googleClientId: <YOUR GOOGLE CLIENT ID>
    googleClientSecret: <YOUR GOOGLE CLIENT SECRET>
  passwordPolicy:
    isWhitespacesAllowed: false
    repeatedPasswordAllowed: false
    minimumLength: 6
    minimumLowerCharacters: 0
    minimumUpperCharacters: 1
    minimumSpecialCharacters: 0
    passwordReuseFrequencyDays: 0
  maxFailedLoginAttempts: 3
  failedLoginLockExpirationMillis: 5000 # 5 second
  activationTokenExpirationMillis: 300000 # 5 minutes
  passwordResetTokenExpirationMillis: 300000 # 5 minutes
  failedLoginIntervalMillis: 10000 # 10 seconds
mailing:
  host: "smtp.gmail.com"
  port: 587
  username: <YOUR ADMIN GMAIL>
  password: <YOUR ADMIN GMAIL APP PASSWORD>
  timeout: 10000
payment:
  momo:
    partnerCode: <YOUR MOMO PARTNER CODE>
    accessKey: <YOUR MOMO ACCESS KEY>
    secretKey: <YOUR MOMO SECRET KEY>
shipping:
  ghtk:
    apiToken: <YOUR GIAOHANGTIETKIEM TOKEN API>
  1. Navigate to the project's main directory and run the following command to start the container:
docker compose up -d
  1. Once the container is running, access the Swagger documentation page at: http://localhost:5000/swagger-ui.html

  2. Use the following accounts to access authorized endpoints:

    User Admin
    Username user00 admin
    Password String String
  3. Stop and remove the container by using:

docker compose down

Screenshots

Swagger Documentation Page

Screenshot 2023-12-13 111616

Screenshot 2023-12-13 111634

User-related APIs

image

Response example

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published