How to easily send mails in NestJS?

Sending emails is a critical functionality in many applications, whether for user notifications, transactional updates, or marketing purposes. However, implementing email solutions can sometimes be cumbersome, as you have to integrate mailer with template language, check for dependencies… But! With the @nestixis/nestjs-mailer package, you can simplify this process while ensuring flexibility and reliability. This package leverages the power of React and Nodemailer, making it a modern and developer-friendly tool for building dynamic email templates and sending emails effortlessly. ...

January 5, 2025 · 3 min

How to solve dual write problem in NestJS?

There are only two hard things in Computer Science: cache invalidation and naming things. – Phil Karlton Well, let’s add another one to the list: consistency. In distributed systems or modular monoliths, maintaining data consistency across multiple services or modules can be quite a challenge. Let’s imagine we have an e-commerce application with two services: OrderService and PaymentService. The OrderService is responsible for confirming orders, while the PaymentService handles the payment processing. Here’s a simplified example in NestJS: ...

September 15, 2024 · 9 min

A Smart Way to Create Scalable Web Sockets in NestJS

A long time ago, I found myself in a situation where I had to create a scalable system that could be capable of handling hundreds of simultaneous connections at not very high cost, and with reasonable, but not instant time of response. My first thoughts? Let’s move all create/edit/delete actions to the queue and notify users if their actions succeeded or not via WebSocket. But back then, I hadn’t much experience with WebSockets in production, so my first step was to investigate how it works with the help of tutorials, stack overflow, and other sources. ...

October 28, 2023 · 8 min

How to Make JWT More Secure in NestJS

Recently, I’ve been thinking about how to make some of my crucial endpoints more secure when using locally stored JWT. It may not be the best practice for security (because of the possibility of XSS attacks), but this was a requirement not set by me. I had to adapt. So in order to make this more secure, I’ve found a solution, that, hopefully, will help you as well. ...

October 28, 2023 · 4 min