Eolo is a RESTful app that can accept and manipulate images uploaded by the user. The manipulation is deferred thanks to a queue. Lastly, a feed provides a list of all images available for every user. Eolo embraces twelve factors, cutting-edge performances, and functional programming.
- With ESM module support and
experimental-specifier-resolution=node - Full stricted Typescript code
- Fine granular configuration of Eslint, Prettier and Tsc
- Domain Driven Development throught Decoder and Parsers
Eolo uses a number of open source projects to work properly:
- PolkaJS - A micro web server so fast, it'll make you dance! 👯
- FP-TS - Functional programming in TypeScript
- IO-TS - Runtime type system for IO decoding/encoding
- Sharp - High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images.
- Node.js - evented I/O for the backend
- Redis - Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.
- Pino - 🌲 super fast, all natural json logger 🌲
And of course Eolo is itself open source with a public repository on GitHub.
Eolo requires Node.js v16+ and Redis v6.2+ to run.
Install the Nodejs runtime and Redis following respective documentations. Then...
provide a custom .env file, ie:
cp .env.example .envbootstrap Server with:
yarn install
LOG_LEVEL=info yarn start
## for production:
yarn install --production
LOG_LEVEL=info NODE_ENV=production yarn start
and start the Worker:
LOG_LEVEL=info yarn worker
## for production:
LOG_LEVEL=info NODE_ENV=production yarn workerIn case of errors ie: ECONNREFUSED, etc. Please consider to properly tweak the following Env's variables.
What follows is a table of principal variables and some examples
| Env Name | Example |
|---|---|
| NODE_ENV | production |
| LOG_LEVEL | info, warn, error or debug, default silent |
| PORT | default 3000 |
| REDIS_PREFIX | prefix |
| REDIS_PORT | 6379 |
| REDIS_HOST | 127.0.0.1 |
| REDIS_FAMILY | 4 |
| REDIS_PASSWORD | "CHANGEME" |
| REDIS_DB | 0 |
| UPLOADS_FOLDER | "uploads/" |
Once dependencies were installed, execute
yarn test
for coverage:
yarn test:coverage
Eolo can be executed from a container without any further ado.
Please take care to properly provide a working .env file (for an exaustive list please consider: Env Variables ) and then issue:
docker-compose upEventualy adjust write permissions of upload folder.
verify that server working is awake with the following command
curl -H "Content-Type: application/json" -X GET http://localhost:3030/healthzthen submit a new image
curl -F username=pluto -F image=@/home/Users/pluto/32178.jpg http://localhost:3030/api/v1/imageor see all user's images
curl -X GET http://localhost:3030/api/v1/image/pluto/An Html page with a POC is available on example folder, to play with it issue:
cd example
npx static-server