Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

nidble/eolo

Repository files navigation

Eolo

Codacy Badge Codacy Badge

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

Tech

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.

Installation

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 .env

bootstrap 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 worker

In case of errors ie: ECONNREFUSED, etc. Please consider to properly tweak the following Env's variables.

Enviromental 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/"

Testing

Once dependencies were installed, execute

yarn test

for coverage:

yarn test:coverage

Docker

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 up

Eventualy adjust write permissions of upload folder.

Curl Examples

verify that server working is awake with the following command

curl -H "Content-Type: application/json" -X GET http://localhost:3030/healthz

then submit a new image

curl -F username=pluto -F image=@/home/Users/pluto/32178.jpg http://localhost:3030/api/v1/image

or see all user's images

curl -X GET http://localhost:3030/api/v1/image/pluto/

FE Example

An Html page with a POC is available on example folder, to play with it issue:

cd example
npx static-server

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published