Skip to content

evans-costa/catalog-services

Repository files navigation


Catalog Service

A catalog marketplace service using Node.js, Express and AWS SQS and SNS services

Key Features

  • Create, update or delete a category of your catalog
  • Create, update or delete a product of your catalog
  • When catalog changes (by adding a product, update or delete it), a message will send to the AWS SQS service
  • When a consumer consumes this message, the updated catalog is send to the AWS S3
  • When you access the catalog endpoint passing the owner of this catalog, you get the updated catalog in JSON.
  • All error logs will be displayed in ./logger folder

Motivation

My biggest challenge developing this project was learn a notification service that listening to a consumer. With this project, I learn the basics of a notification and message services, and how can I implement this using Node and PostgreSQL as well. Also, I learned logging mechanisms, using Pino to create a .log file, handle errors properly and validate fields using Joi

How To Use

  • To clone and run this application, you'll need Git, Node.js (which comes with npm) and Docker with Docker Compose installed on your computer. From your command line:

    # Clone this repository
    $ git clone https://github.com/evans-costa/catalog-services.git
    
    # Go into the repository
    $ cd catalog-services
    # Install dependencies
    $ npm install
  • Rename the .env.example file to .env and fill it accordingly:

    PORT=
    
    POSTGRES_USER=
    POSTGRES_PASSWORD=
    POSTGRES_DB=
    POSTGRES_HOST=
    POSTGRES_PORT=
    DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB
    
    AWS_ACCESS_KEY_ID=
    AWS_SECRET_ACCESS_KEY=
    AWS_REGION=
    AWS_TOPIC_ARN=
    AWS_SQS_QUEUE_URL=
    AWS_S3_BUCKET=
  • Run the command to start the server:

    # Run the project
    $ npm run dev

    This will up a PostgreSQL container on your Docker installation, run the migrations and start the server and the SQS Consumer as well.

  • Now you can test it in your favorite API Testing Platform (Insomnia, Postman, Hoppscotch)

Project structure

  • Click here to see the final project structure diagram.

API documentation

Improvements

  • Write tests using Jest

Credits

This project was taken from this repo from AnotaAí backend challenge and was made with the following open source packages:

License

The MIT License (MIT) 2024 - Evandro Costa. Please have a look at the LICENSE for more details.

Releases

No releases published

Packages

No packages published