alecuba16 / node_microservices_mongodb

A simple implementation of a microservice architecture, with an API Gateway that derives the task depending on the endpoint path to two microservices. The API gateway uses JWT for authentication to run and authenticate the users without having to store sessions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Microservices in Nodejs (typescript) with API gateway, JWT authentication for document processing (pdf->txt) (microservice1), and sentiment analysis (microservice 2)

This project is a simple implementation of a microservice architecture. It includes an API Gateway that derives the task to two different microservices, depending on the endpoint path. The API gateway uses JWT for authentication to run and authenticate the users without having to store sessions.

Document Reader (microservice 1)

The document processing only has the "documentReader/document" endpoint, which accepts CRUD methods. The information is forwarded from the "front" gateway that verifies the user's authentication before the redirection. The document reader works as a standard rest API without authentication (because the gateway has done it before). The document is uploaded via post as form-data and processed asynchronously. Once it is processed, it returns the documentId that has been inserted into the MongoDB.

Document Analyzer (microservice 2)

This second microservices exposed via the endpoint documentAnalyzer/analyzeSentiment, forwarded through the API gateway. It does a basic sentiment analysis from the document converted by the documentReader microservice. To achieve this, the user has to provide the documentId generated by the documentReader once a document has been inserted and stored into the DB.

The result is the positive, negative, and neutral words found in the document you provided.

#Screenshots: General service view General service view

Postman query to the processed documents (pdf->txt) Postman query to the processed documents (pdf->txt)

Postman query with the result of the sentiment analysis Postman query with the result of the sentiment analysis

Postman login result with the JWT token required to query the internal microservices Postman login result with the JWT token required to query the internal microservices

About

A simple implementation of a microservice architecture, with an API Gateway that derives the task depending on the endpoint path to two microservices. The API gateway uses JWT for authentication to run and authenticate the users without having to store sessions.

License:MIT License


Languages

Language:TypeScript 97.9%Language:Dockerfile 1.2%Language:JavaScript 1.0%