Proxy server for image optimization on Node.JS use (fastify, axios, sharp) Automatic recognition of browser support formats WebP
yarn add node-imgoptimize
git clone https://github.com/AntonLukichev/node-imgoptimize.git
yarn install
npm install node-imgoptimize --save
git clone https://github.com/AntonLukichev/node-imgoptimize.git
npm install
Requires node >= 8.0, but I recommended use >= 10.0 LTS
example https://node-imgoptimize.herokuapp.com/
$ git clone https://github.com/AntonLukichev/node-imgoptimize.git
$ cd ./node-imgoptimize
$ docker build -t node-imgoptimize .
$ docker run -it --rm -p 3000:3000 -e NODE_ENV=production node-imgoptimize
$ git clone https://github.com/AntonLukichev/node-imgoptimize.git
$ cd ./node-imgoptimize
$ docker-compose build
$ docker-compose up
see tips for Docker
{url}?w=500&q=80
support parameters (after "?"):
w - image width;
h - image height;
q - image quality, 80 recommended for JPEG and WebP;
fm - image format, list in config.js and default jpeg or webp (if browser supports it);
Edit defaults config for you need (automatically created after the first run)
./config/config.js
./config/server.js
v0.2.0:
- generate source url with original request parameters
- caching original file
- support a large number of files
v0.3.0:
- add multiple path URI
- add JPEG and WebP options
v0.4.0:
- custom log level
- documentation API in Swagger
- add docker
- support Heroku
v0.5.0:
- add monitoring errors sentry.io
- default favicon
- add tests
v1.0.0:
- migrate Typescript and NestJS
I plan to implement in the future:
- add CORS
- expand API
- add options Low Quality Image Placeholders (LQIP)
- add Client Hints (headers DPR, Viewport-Width, Width) for support Chrome, Opera, Android Chrome
- add support another formats (GIF, PNG, SVG...)
- divide the functionality into modules up to version 1.0.0
- support PAAS (
Heroku, Zeit, Nanobox...) - add support HTTP2
- add security protection
- add support redis/mongo for cache info
- add image operations (rotate, blur, normalise...)
If you'd like to lazy load images, I recommend using lazysizes.
Simple copy your favicon.ico file in root directory project
Production Best Practices: Security
See the CONTRIBUTING file here
Copyright (c) Anton Lukichev