test coverage

June 21, 2024 ยท View on GitHub

Nest Logo MongoDB Logo Amazon S3 Logo Docker Logo Docker Compose Logo Heroku Logo Sharp - High performance Node.js image processing

Some of the technologies and services used in this project.

Description

Image management system that uses Nest Js in the backend to create a modular and easily scalable system. User information and photo data are stored in MongoDB, while photos are saved in the cloud via Amazon S3. The system implements a caching mechanism to avoid unnecessary calls to the storage service, reducing costs and significantly improving performance in delivering requested images. The deployment and orchestration are handled using Docker and Docker Compose, making it easy to set up the development environment and manage containers. For deployment, Heroku is used to provide a reliable and scalable cloud platform.

Installation

$ yarn install

Running the app

# Important - Configure the .env file

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run build
$ yarn run start:prod

Running the app in Docker

# Important - Configure the .env file

# development opening bash from docker container
$ yarn run docker:local

Inside docker >> $ yarn run start:dev

# development using docker compose
$ docker compose up

# production mode
$ docker compose up app

Test

# unit tests
$ yarn run test

# test coverage
$ yarn run test:cov

test coverage

$ yarn run test:cov

API Test

Import the insomnia.json file
  • Create a user or login user to generate jwt token
  • Upload the image to created user
  • List user images
  • Get image passing parameters

Future improvements

  • Added redis to persist the cache
  • Addition of a messaging service to control the entry of images for upload.
  • Study of automatic deployment on Amazon EC2
  • Development of more backend features (Image deletion, thumbnail image, multiple upload...)
  • Development of a frontend for the project
  • Distribution of the service/modules following the in the future architecture document that is attached to the project (./architecture-proposed.pdf).

Stay in touch

License

Nest is MIT licensed.