Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dekiakbar/image-optimizer

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.
https://github.com/dekiakbar/image-optimizer

api api-rest image-processing nestjs nestjs-api nestjs-backend nodejs optimize-images

Last synced: 3 months ago
JSON representation

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.

Awesome Lists containing this project

README

        

# Image Optimizer Backend



Build


Deploy


Lint


Build




---

## Table of Contents

- [Installation](#installation)
- [Without docker](#without-docker)
- [Docker](#docker)
- [Deployment](#deployment)
- [Environment Variable](#environment-variable)
- [Frontend](#frontend)
- [License](#license)

## Installation

### Backend (this repo)
- #### Without docker

- ```bash
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```

- ```bash
# Navigate to project dir
cd image-optimizer
```

- ```bash
# Install node modules and dependencies
npm install
```

- ```bash
# Run app

# development
$ npm run start

# Watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
```

- ```bash
# access swager api
http://localhost:/api
```

- #### Docker
- ```bash
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```

- ```bash
# Navigate to project dir
cd image-optimizer
```

- ```bash
# Build image and start container
docker-compose up -d
```

- ```bash
# access swagger api
http://localhost:3000/api
```
- #### NOTE : if you wanna run npm command, please use this.
```bash
docker-compose run --rm node npm install --legacy-peer-deps
```
## Deployment
- #### Docker
- ```bash
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```

- ```bash
# Navigate to project dir
cd image-optimizer
```

- ```bash
# 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`

```bash
cp .env.example .env
```

Fill the required `env` variables:
```bash
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](https://github.com/dekiakbar/image-optimizer-fe).

## License
[MIT](https://github.com/dekiakbar/image-optimizer/blob/master/LICENSE)