Skip to content

Imageoptimizer image is a simple app for compressing any image file. It takes a single input file and compresses it to a much smaller output file.

License

Notifications You must be signed in to change notification settings

dekiakbar/image-optimizer

Repository files navigation

Image Optimizer Backend

Build Deploy Lint Build


Table of Contents

Installation

Backend (this repo)

  • Without docker

    •   # Clone this repository
        git clone https://github.com/dekiakbar/image-optimizer
    •   # Navigate to project dir
        cd image-optimizer
    •   # Install node modules and dependencies
        npm install
    •   # Run app
      
        # development
        $ npm run start
      
        #  Watch mode
        $ npm run start:dev
      
        # production mode
        $ npm run start:prod
    •   # access swager api
        http://localhost:<port>/api
  • Docker

    •   # Clone this repository
        git clone https://github.com/dekiakbar/image-optimizer
    •   # Navigate to project dir
        cd image-optimizer
    •   # Build image and start container
        docker-compose up -d
    •   # access swagger api
        http://localhost:3000/api
    • NOTE : if you wanna run npm command, please use this.

      docker-compose run --rm node npm install --legacy-peer-deps

Deployment

  • Docker

    •   # Clone this repository
        git clone https://github.com/dekiakbar/image-optimizer
    •   # Navigate to project dir
        cd image-optimizer
    •   # Build image and start container
        docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Environment Variable

Copy env.example to .env

cp .env.example .env

Fill the required env variables:

PORT=3000

# Storage type for save image
# valid :
# - S3
STORAGE_TYPE=S3

# if use S3 as storage
S3_BUCKET_NAME=
S3_REGION=global
S3_ENDPOINT=
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=

# separated by space and please provide (dot) before list the extension
ALLOWED_FILE_TYPE=.jpeg .jpg .png
MAX_FILE_UPLOAD=5
# max upload size in KB
MAX_UPLOAD_SIZE=8192

Frontend

You must install image optimizer Frontend.

License

MIT