Text translation using Google Cloud Translation API i in a NestJS application

Loading

Reading Time: 7 minutes Introduction I am a language learner who learns Mandarin and Spanish in my spare time. When I discovered that text translation using Google Cloud Translation API is possible, I wanted to leverage the strength of Google Cloud and a translation-specialized large language model (LLM) in my hobby. Therefore, I built a NestJS application to translate … Read more

Text translation using langchain.js and Gemini in a NestJS application

Loading

Reading Time: 7 minutes Introduction I am a language learner, and I learn Mandarin and Spanish in my spare time. When I discovered that text translation using langchain.js and Gemini 1.0 Pro is possible, I wanted to leverage the strength of generative AI in my hobby. Therefore, I built a NestJS application to translate texts between two languages through … Read more

Text translation using Azure OpenAI Translator in a NestJS application

Loading

Reading Time: 7 minutes Introduction I am a language learner, and I learn Mandarin and Spanish in my spare time. When I discovered that text translation using Azure OpenAI is possible, I wanted to leverage the strength of generative AI in my hobby. Therefore, I built a NestJS application to translate texts between two languages through Azure OpenAI’s translator … Read more

Queuing jobs in NestJS using @nestjs/bullmq package

Loading

Reading Time: 7 minutes Introduction Both Bull and BullMQ are queue libraries that persist jobs in Redis. Bull is in maintenance mode and maintainers only fix bugs in the library. The new version of the library, BullMQ, is rewritten in TypeScript. Bull and BullMQ are similar except BullMQ introduces flow producer that can split a resource-intensive job into children … Read more

Create NestJS health check library

Loading

Reading Time: 6 minutes Introduction NestJS applications in my company implement health checking for k8s liveness probe. These applications check the following items are up and running: backend, database, redis, bull queue and external servers. Eventually, different backend teams encapsulate similar endpoint and services in a heath check module and import it to the application. This approach is not … Read more

Check health of nestjs bull queue with terminus

Loading

Reading Time: 5 minutes Introduction It is common for enterprise applications to connect to external resources to process requests and get back responses. Therefore, application should know that the components it depends on are up and running all the times. Otherwise, the application behaves erroneously when serving client requests. To stay aware of the availability of connected resources, we … Read more

Queue and job processing in nestjs

Loading

Reading Time: 5 minutes Introduction The responsibility of backend application is to handle client requests and return responses back to the client. However, backend performance can degrade when the request is resource intensive; UI thread waits endlessly and user interface is blocked for further user actions. To avoid the unresponsiveness, we can place jobs in queue and delegate the … Read more

Lint files and dependencies in NestJs with unimported

Loading

Reading Time: 5 minutes Introduction When developers maintain a NestJS project, they add and delete codes to the project that some dependencies and files become redundant. When unused files and dependencies are left around, they become technical debts and reduce the code quality. Fortunately, we can use unimported to lint files and dependencies before git commit to avoid pushing … Read more

Create dynamic module made easy in NestJS 9

Loading

Reading Time: 4 minutes Introduction Our technology team builds a lot of Nestjs libraries to reuse in Nestjs applications. Our libraries provide forRoot() to create dynamic module only. Therefore, we cannot call forRootAsync() to register asynchronous module by importing modules and injecting services. Before V9, there are many boilerplate codes to get forRootAsync() to work. Internally, forRootAsync invokes createAsyncProvider … Read more