Marcin Wanago
Marcin Wanago is a senior software engineer and creator of the API with NestJS series. He contributes long-form NestJS tutorials to NestJS.io with permission.
Articles by Marcin Wanago (187)
A video chat with WebRTC and React
Let’s say two people want to video chat using our app. One solution would be for the first person to stream their camera feed to our server. Then, our…
Aggregating statistics with PostgreSQL and Prisma
We can learn much about how users use our app by looking at our database. With this information, we can improve the experience of the users of our application.…
An introduction to CQRS
So far, in our application, we’ve been following a pattern of controllers using services to access and modify the data. While it is a very valid approach,…
Arrays with PostgreSQL and Kysely
PostgreSQL outshines various other SQL databases with its feature set. Unlike most SQL databases, PostgreSQL offers extensive support for array columns. Using…
Arrays with PostgreSQL and Prisma
PostgreSQL stands out as a feature-reach solution among other relational databases. Most of the column types available in PostgreSQL allow storing a single…
Arrays with PostgreSQL and the Drizzle ORM
Thanks to some of its features, PostgreSQL sets itself apart from other SQL databases. Unlike many SQL databases that limit columns to single entries,…
Authenticating users with bcrypt, Passport, JWT, and cookies
Authentication is a crucial part of almost every web application. There are many ways to approach it, and we’ve handled it manually in our TypeScript Express…
Authenticating users with Google
Authenticating users with emails and passwords is a valid and common approach. However, a convenient alternative is to shift this responsibility to a third…
Authorization with roles and claims
So far, in this series, we’ve implemented authentication. By doing that, we can confirm that the users are who they claim to be. In this series, we explain how…
Avoiding storing sensitive information in API logs
In previous parts of this series, we’ve learned how to implement logging in our REST API. Logs play an important role in debugging and maintaining reliable…
Cache with Redis. Running the app in a Node.js cluster
Redis is a fast and reliable key-value store. It keeps the data in its memory, although Redis, by default, writes the data to the file system at least every 2…
CI/CD with Amazon ECS and GitHub Actions
In the last two parts of this series, we’ve explained the details of manually deploying our NestJS application with Amazon Elastic Compute Cloud. It’s a great…
Communicating with microservices using the gRPC framework
With NestJS, we have quite a few transport layer implementations prepared for microservices. Among them, the gRPC transporter is definitely one of the most…
Composing classes with the mixin pattern
Inheritance is one of the four pillars of object-oriented programming. JavaScript has the prototype-based inheritance, and with it, one object can acquire…
Confirming the email address
In a lot of web applications, emails play a significant role. If we create an online ordering system, we need to be confident that our users get a confirmation…
Constraints with PostgreSQL and Prisma
One of the most important aspects of working with a database is ensuring the stored information is correct. One of the fundamental ways of doing that is by…
Controllers, routing and the module structure
NestJS is a framework for building Node.js applications. It is somewhat opinionated and forces us to follow its vision of how an application should look like…
CORS – Cross-Origin Resource Sharing
Cross-Origin Resource Sharing (CORS) is a mechanism for disallowing or allowing resources to be requested from another origin. It is built into web browsers…
Creating CLI applications with the Nest Commander
Command Line Applications are very useful for developers. We can interact with them by executing specific commands in the terminal, giving us much control and…
Creating relationships with Postgres and TypeORM
When we build an application, we create many entities. They often somehow relate to each other, and defining such relationships is an essential part of…
Database migrations with Prisma
One of the characteristics of relational databases is a strict data structure. We need to specify the shape of every table with its fields, indexes, and…
Database migrations with the Drizzle ORM
Relational databases are known for their strict data structures. Every table requires a defined schema, including columns, indexes, and relationships. Despite…
Database migrations with TypeORM
When working with relational databases, we define the structure of the data rather strictly. For example, we need to specify the format of every table along…
Database normalization with Drizzle ORM and PostgreSQL
Database normalization is a key part of database design, but it’s often explained in complicated terms. In this article, we’ll break down the normalization…
Date and time with PostgreSQL and the Drizzle ORM
Storing date and time in a database can be challenging, but it’s important to get it right. In this article, we solve this problem using PostgreSQL and the…
Date and time with Prisma and PostgreSQL
Storing date and time in our database might be tricky, but it is essential to get it right. In this article, we tackle this issue using PostgreSQL and Prisma.…
Dealing in the N + 1 problem in GraphQL
In the previous article, we’ve implemented resolvers and queries. There is quite a common catch with them, though. It is referred to as the N + 1 problem. In…
Dealing with circular dependencies
We need to watch out for quite a few pitfalls when designing our architecture. One of them is the possibility of circular dependencies. In this article, we go…
Defining constraints with raw SQL
Having significant control over the data we store in our database is crucial. One of the ways to do that is to choose suitable column types. We can also use…
Defining dynamic modules
So far in this series, we’ve defined many different modules that can group provides and controllers. None of them was customizable, though. In this article, we…
Defining transactions with PostgreSQL and TypeORM
One of the important concepts to understand when dealing with databases is a transaction. It is a unit of work that we treat as a whole. It either happens…
Definining indexes with MongoDB and Mongoose
The bigger our database is, the more demanding our queries become in terms of computing power. A common way of tackling this problem is by creating indexes. In…
Deploying a NestJS app with Amazon ECS and RDS
In the last two parts of this series, we’ve dockerized our NestJS application. The next step is to learn how to deploy it. In this article, we push our Docker…
Deploying multiple instances on AWS with a load balancer
In the previous article, we learned how to use the Elastic Container Service (ECS) to deploy a single instance of our application. This time, we take a step…
Designing many-to-one relationships using raw SQL queries
Learning how to design and implement relationships between tables is a crucial skill for a backend developer. In this article, we continue working with raw SQL…
Distance and radius in PostgreSQL with Drizzle ORM
PostgreSQL provides many options for working with geographical data, especially with the PostGIS extension. In this article, we’ll explore how to calculate the…
Dockerizing a NestJS API with Docker Compose
So far, in this series of articles, we’ve been using Docker to run various services our NestJS application depends on. Some good examples are PostgreSQL and…
Error handling and data validation
NestJS shines when it comes to handling errors and validating data. A lot of that is thanks to using decorators. In this article, we go through features that…
Exploring the idea of microservices
As our application grows, maintaining it might become more challenging. One of the approaches that we can take is to structure our app with microservices. You…
Filtering records with Prisma
Filtering records is one of the essential skills to have when working with SQL databases. In this article, we’ll implement various examples using NestJS and…
Full-text search with the Drizzle ORM and PostgreSQL
With PostgreSQL’s full-text search feature, we can quickly find documents that contain a particular word or phrase. It can also sort the results to show the…
Generated columns with the Drizzle ORM and PostgreSQL
In SQL, generated columns automatically calculate their values using data from other fields in the same table. This can help ensure data consistency, improve…
Generating documentation with Compodoc and JSDoc
The reality of software projects is that people sometimes come and go. Therefore, the bigger our application is, the higher value we put on the ability to more…
Generating statistics using aggregate functions in raw SQL
So far, we’ve been mostly writing SQL queries that either store or retrieve the data from the database. Besides that, we can rely on PostgreSQL to process the…
Getting distinct records with Prisma and PostgreSQL
PostgreSQL allows us to filter a query’s results and ensure we don’t get duplicate rows. This can be helpful when your table has many rows where the data in…
Handling CPU-intensive tasks with queues
Handling CPU-intensive operations with REST API can be tricky. If our endpoint takes too much time to respond, it might result in a timeout. In this article,…
Handling date and time in PostgreSQL with Kysely
Saving date and time in our database can be tricky, but it’s crucial to do it correctly. In this article, we address this problem using PostgreSQL and Kysely.…
Handling JSON data with PostgreSQL and the Drizzle ORM
PostgreSQL is well-suited for handling structured data and keeping everything organized and consistent. On the other hand, MongoDB stores data in flexible…
Handling SQL constraints with Kysely
When using SQL databases, we can set constraints to ensure our data remains accurate and reliable during insertions, updates, or deletions. In this article,…
Health checks with Terminus and Amazon ECS
In one of the previous parts of this series, we learned how to use the Elastic Container Service to deploy multiple instances of our application. With this…
Health checks with Terminus and Datadog
We should be aware of whether our application is healthy. One way to do that would be to make various API requests to confirm it manually. It might not be the…
Identity columns with the Drizzle ORM and PostgreSQL
Most of our SQL tables contain the ID column, which acts as a primary key and uniquely identifies each row. Historically, the most common way of defining them…
Implementing filtering using subqueries with raw SQL
In this series, we’ve often had to filter the records in our database. We can achieve that with a simple WHERE clause.SELECT * FROM posts WHERE author_id = 1In…
Implementing in-memory cache to increase the performance
There are quite a few things we can do when tackling our application’s performance. We sometimes can make our code faster and optimize the database queries. To…
Implementing many-to-one relationships with Drizzle ORM
Managing relationships between tables is a significant part of dealing with SQL databases. In this article, we continue learning to use Drizzle ORM with NestJS…
Implementing pagination with MongoDB and Mongoose
When our application grows, so does the database. At some point, we might return a lot of data from our endpoints. It might prove to be too much for our…
Implementing refresh tokens using JWT
In the third part of this series, we’ve implemented authentication with JWT, Passport, cookies, and bcrypt. It leaves quite a bit of room for improvement. In…
Implementing relationships with MongoDB
An essential thing about MongoDB is that it is non-relational. Therefore, it might not be the best fit if relationships are a big part of our database design.…
Implementing searching with pattern matching and raw SQL
The possibility of searching through the contents of the database is a very common feature. There are great solutions built with that use case in mind, such as…
Implementing soft deletes using MikroORM and filters
In this article, we look into the filters feature and implement soft deletes. With them, we can mark an entity as deleted without removing it from the database…
Implementing soft deletes with PostgreSQL and TypeORM
In this series, we’ve implemented deleting functionalities for various entities. So far, it has always meant removing records permanently from our database.…
Implementing soft deletes with Prisma and middleware
When developing our REST APIs, we often focus on implementing the four fundamental operations: creating, reading, updating, and deleting (CRUD). The most basic…
Implementing soft deletes with SQL and Kysely
When working on our REST APIs, we usually focus on implementing the four fundamental operations: creating, reading, updating, and deleting (CRUD). Deleting…
Improving performance of our Postgres database with indexes
As our system grows, certain queries on our database might fail us in terms of performance. One of the popular ways of dealing with this issue are indexes.…
Improving performance through indexes with Prisma
The bigger our database, the more we need to care about its performance. A common way of improving it is through indexes. Therefore, this article introduces…
Improving PostgreSQL performance with indexes using MikroORM
The complexity of our database queries grows together with our application. Due to that, the time necessary to complete the queries. A common way to address…
Improving the database performance with indexes and Kysely
SQL indexes act like guides in our database and help us retrieve the data faster. The bigger our database is, the more emphasis we need to put on its…
Improving the performance with indexes using Drizzle ORM
As our database grows, focusing more on its performance is important. SQL indexes act as guides within the database, helping to speed up data retrieval. In…
Increasing the developer experience with Docker Compose
The previous article taught us how to use Docker and Docker Compose with NestJS. In this article, we expand our knowledge by applying various tricks and tips…
Integration tests with Prisma
In the previous part of this series, we learned how to write unit tests in a NestJS project with Prisma. Unit tests help verify if individual components of our…
Integration tests with the Drizzle ORM
Writing tests for our application helps ensure it works as intended and is reliable. So far, we have written unit tests for our NestJS application that uses…
Interacting with the application through REPL
The NestJS team officially announced NestJS 9 on July 8th. One of its features is Read-Eval-Print-Loop (REPL) implementation. It is an environment that allows…
Introducing database normalization with PostgreSQL and Prisma
Database normalization is a common topic in database design discussions. However, it’s usually explained using complicated terms, making it hard to understand.…
Introduction to a monorepo with Lerna and Yarn workspaces
Monorepo is an approach in which we store multiple projects in the same repository. It is common across big tech companies, such as Uber or Google. Even NestJS…
Introduction to Elasticsearch
We can find some searching functionalities in a lot of web applications. While we might be fine when iterating through a small data set, the performance for…
Introduction to feature flags
With feature flags (also referred to as feature toggles), we can modify our application’s behavior without changing the code. In this article, we explain the…
Introduction to GraphQL. Queries, mutations, and authentication
GraphQL has gained quite a lot of popularity lately. And no wonder, because it is an interesting approach to querying data. Therefore, it is definitely worth…
Introduction to indexes with raw SQL queries
As our database grows, we need to put more and more emphasis on performance. A popular approach to dealing with this problem is by implementing indexes. In…
Introduction to logging with the built-in logger and TypeORM
As our application grows, more and more people start depending on it. At a time like this, it is crucial to ensure that our API works well. To do that, we…
Introduction to managing logs with Amazon CloudWatch
In this series, we’ve learned how to use the logger built into NestJS. In this article, we learn how to manage the logs our NestJS application produces using…
Introduction to MikroORM with PostgreSQL
So far, in this series, we’ve used a few different solutions for managing databases. To work with MongoDB, we’ve used Mongoose. To manage a PostgreSQL…
Introduction to MongoDB
So far, in this series, we’ve focused on working with SQL and the Postgres database. While PostgreSQL is an excellent choice, it is worth checking out the…
Introduction to Prisma with PostgreSQL
So far, in this series, we’ve been using TypeORM to manage our data and connect to our Postgres database. In this article, we look into Prisma, which is a…
Introduction to Stripe with React
Nowadays, a lot of web applications accept online payments. Although this is not straightforward to implement, there are some ready-to-use solutions that we…
Introduction to the Drizzle ORM with PostgreSQL
Drizzle is a lightweight TypeScript ORM that lets us manage our database schema. Interestingly, it allows us to manage our data through a relational API or an…
Logging with Prisma
Using a debugger with an application running locally on our machine is a great way to troubleshoot. Unfortunately, we can’t do that with a deployed app. To be…
Logging with the built-in logger when using raw SQL
Troubleshooting a deployed application can be challenging. We can’t use the debugger and stop an application used by other people. Instead, we need to…
Logging with the Drizzle ORM
Debugging is a great way to find issues when running an application locally. Unfortunately, we don’t have this option in a deployed application. Because of…
Looking into dependency injection and modules
NestJS strives to focus on the maintainability and testability of the code. To do so, it implements various mechanisms such as the Dependency Injection. In…
Managing JSON data with PostgreSQL and Kysely
PostgreSQL is great for structured data and is known for its reliability in maintaining data organization and consistency. On the other hand, MongoDB stores…
Managing JSON data with PostgreSQL and Prisma
Relational databases such as PostgreSQL are great for storing structured data. This approach has many advantages, but it can lack flexibility. On the other…
Managing PostgreSQL relationships with Prisma
As applications grow, the number of different entities also increases. A crucial part of learning how to design a database is creating relationships between…
Managing private files with Amazon S3
There is quite a bit more to Amazon S3 than storing public files. In this article, we look into how we can manage private files. To do so, we learn how to set…
Managing sensitive data using the AWS Secrets Manager
When managing the architecture of our system, we often deal with sensitive data. It’s our job to ensure they don’t fall into the wrong hands. An excellent…
Managing transactions with MongoDB and Mongoose
While working with databases, keeping the integrity of the data is crucial. For example, imagine transferring money from one bank account to another. To do…
Many-to-many relationships using raw SQL queries
Designing relationships between tables is one of the crucial parts of working with databases. In this article, we look into a more complex relationship called…
Many-to-many relationships with Drizzle ORM and PostgreSQL
Creating relationships across tables is a crucial aspect of working with SQL databases. Previously, this series focused on using the Drizzle ORM to create…
Many-to-many relationships with Kysely and PostgreSQL
Implementing relationships across tables is a crucial aspect of working with SQL databases. So far, this series covers using Kysely to design simple…
Many-to-one relationships with PostgreSQL and Kysely
Designing relationships is one of the crucial aspects of working with SQL databases. In this article, we continue using Kysely with NestJS and implement…
Migrating to TypeORM 0.3
For a long time, TypeORM seemed to have a reputation of being somewhat stagnant. Lately, they stepped up their game, though, and started releasing many new…
Modifying data using PUT and PATCH methods with Prisma
Developing a REST API requires us to create endpoints using various HTTP methods such as GET, POST, and DELETE. People utilizing our API expect that making a…
Multiple PostgreSQL schemas with Drizzle ORM
PostgreSQL uses schemas as namespaces within the database to hold tables and other structures, such as indexes. In this article, we explain how to use them…
Offset and keyset pagination with Kysely
So far, when working with Kysely, we fetched all rows from our tables. However, this might not be the best solution when it comes to performance. A common…
Offset and keyset pagination with PostgreSQL and TypeORM
As our database grows, so do the results of our queries. Returning a lot of data in our API might not be the best approach performance-wise. Dividing our…
Offset and keyset pagination with Prisma
The bigger our database, the more we need to care about the performance. Returning too much data at once through our API might not be the best approach when it…
Offset and keyset pagination with raw SQL queries
So far, we have returned the full content of our tables. However, as our database grows, this might prove not to be the best approach in terms of performance.…
Offset and keyset pagination with the Drizzle ORM
As our database grows, maintaining good performance becomes more important. Returning large amounts of data at once through our API can negatively affect…
One-to-one relationships with raw SQL queries
When designing a database, the tables we define often relate to each other. Managing those relationships is one of the essential parts of working with…
One-to-one relationships with the Drizzle ORM
When building a database, the tables we set up often connect to each other. Managing these relationships is one of the crucial parts of working with databases.…
One-to-one relationships with the Kysely query builder
When we design the architecture of our database, we usually end up with tables that relate to each other in some way. Managing such relationships is one of the…
Operations with PostGIS Polygons in PostgreSQL and Drizzle
When using PostgreSQL with PostGIS, we can do various operations using polygons. In this article, we learn how to do that both through raw SQL queries and the…
Optimizing queries with views using PostgreSQL and Kysely
Some of our SQL queries can become quite complicated. Fortunately, we can create views that act as aliases for the select queries. They have a form of virtual…
Organizing Drizzle ORM schema with PostgreSQL
As our application grows, it gets increasingly important to create a file structure that’s easy to maintain. Also, if we care about it from the start, it is…
Pattern matching search with Drizzle ORM and PostgreSQL
Searching through text documents is a very common feature in many web applications. In this article, we learn how to implement it using pattern matching using…
Polymorphic associations with PostgreSQL and Drizzle ORM
It’s not uncommon for a single table to be related to multiple similar tables. A good example is a comment the user can write under a photo, an article, or an…
Polymorphic associations with PostgreSQL and Prisma
Often, we might have a situation where a single entity, such as a comment, needs to be associated with more than one type of table. For example, the user might…
Prepared statements in PostgreSQL with Drizzle ORM
When we execute an SQL query, PostgreSQL follows a process that consists of multiple steps. First, it parses the SQL statement, checking for syntax errors.…
PUT and PATCH requests with PostgreSQL and Drizzle ORM
When users send an HTTP request to our API, they use a specific method to indicate whether they want to retrieve, send, delete, or update data. While we could…
Rate limiting using Throttler
When building a REST API, we must prepare for various cases. At first, everything might run smoothly, but as our API gains traction, we might encounter some…
Raw SQL queries with Prisma and PostgreSQL range types
While Prisma gradually adds various features, PostgreSQL still has a lot of functionalities that Prisma does not support yet. One of them is range types. In…
Reacting to Stripe events with webhooks
So far, in this series, we’ve interacted with Stripe by sending requests. It was either by requesting the Stripe API directly on the frontend, or the backend.…
Real-time chat with WebSockets
With WebSockets, we can perform a two-way communication in real-time between the user and the server. Thanks to that, the browser can send messages to the…
Real-time updates with GraphQL subscriptions
So far, in this series, we’ve used GraphQL both to fetch and modify data. While this covers many real-life cases, modern applications often include situations…
Recursive relationships with Drizzle ORM and PostgreSQL
Managing relationships between the tables in our database is one of the fundamental aspects of using SQL. When a particular table points back to itself, it…
Recursive relationships with Prisma and PostgreSQL
When we work with SQL databases, we usually create tables that relate to each other in some way. Managing those relationships is one of the most fundamental…
Referential actions and foreign keys in PostgreSQL with Prisma
A foreign key is a column that connects two tables. A constraint keeps this connection in check, and PostgreSQL ensures the foreign keys point to the correct…
Relationships with PostgreSQL and MikroORM
A significant advantage of SQL databases is handling relationships between various tables. Since, in web applications, entities often relate to each other,…
Replacing Express with Fastify
By default, NestJS uses Express under the hood. Moreover, since Express is very popular, NestJS can choose from a broad set of compatible third-party…
Response serialization with the Drizzle ORM
When fetching data from the database, we often don’t want to present it to the user in its raw form. To prevent that, we need to serialize the response in…
REST API versioning
The requirements of web applications constantly evolve, and so do the REST APIs they use. With the rise of the popularity of distributed systems and…
Running unit tests with CI/CD and GitHub Actions
We should closely monitor the state of tests in our NestJS application. In a few previous parts of this series, we’ve used Docker and GitHub actions to design…
Scalar types in GraphQL
With GraphQL, we model our API as a graph. Within a schema, we have various types of nodes that can relate to each other. While the fields in our query might…
Scaling the number of application instances with Amazon ECS
In recent articles, we’ve learned how to deploy our NestJS application with Docker and AWS. In addition, we’ve managed to deploy multiple instances of our API…
Securing applications with Helmet
Ensuring that our application is secure is one of the most important things we must do as developers. One of the ways to protect our application from…
Sending scheduled emails with cron and Nodemailer
So far, in this series, we’ve been creating an API that allows users to interact with our application. As soon as the client makes the request, we react to it…
Serializing the response with interceptors
Sometimes we need to perform additional operations on the outcoming data. We might not want to expose specific properties or modify the response in some other…
Serializing the response with Prisma
When fetching data from the database, we do not always want to present it to the user in the original form. When working with NestJS, the most popular way of…
Setting up a PostgreSQL database with TypeORM
The next important thing when learning how to create an API is how to store the data. In this article, we look into how to do so with PostgreSQL and NestJS. To…
Setting up recurring payments via subscriptions with Stripe
In this series, we’ve implemented a few different ways of charging our users using Stripe. So far, all of those cases have included single payments. With…
Soft deletes with raw SQL queries
Removing entities is a very common feature in a lot of web applications. The most straightforward way of achieving it is permanently deleting rows from the…
Soft deletes with the Drizzle ORM
Deleting entities is a standard feature in most REST APIs. The most straightforward approach is to remove rows from the database permanently. However, we can…
SQL constraints with the Drizzle ORM
When working with SQL databases, we can configure constraints to ensure our data does not get corrupted. In this article, we explore and implement different…
SQL transactions with Kysely
The integrity of our data should be one of the primary concerns of web developers. Thankfully, SQL databases equip us with tools that we can use to ensure the…
SQL transactions with the Drizzle ORM
Ensuring the integrity of the data is a fundamental responsibility of each developer. Fortunately, SQL databases give us the tools to ensure our database stays…
Storing coordinates in PostgreSQL with Drizzle ORM
Many applications rely on geographical data to calculate distances and track locations. PostgreSQL offers several ways to store geospatial data, each designed…
Storing files inside a PostgreSQL database
In the previous parts of this series, we’ve learned how to upload files to Amazon S3 and store their metadata in our PostgreSQL database. While this is a…
Storing files inside of a PostgreSQL database with Drizzle
When working with PostgreSQL, we can use the bytea column to store binary data, such as images, PDFs, or other small files. In this article, we explore how to…
Storing JSON with PostgreSQL and TypeORM
So far, in this series, we’ve used PostgreSQL to store data structured in columns. This approach has many benefits, but sometimes, we want some more…
Storing money with Drizzle ORM and PostgreSQL
We can’t cut corners on certain aspects of web development, and storing monetary values is one of them. In this article, we explore various data types in…
Storing PostGIS Polygons in PostgreSQL with Drizzle ORM
PostgreSQL, together with PostGIS, allows us to store various types of geographical data. Besides working with simple coordinates, we can also store entire…
Testing a project with raw SQL using integration tests
Covering our project with tests can help us ensure that our application works as expected and is reliable. While unit tests play a significant role, they are…
Testing services and controllers with integration tests
In the previous part of this series, we’ve focused on unit tests. This time, we look into integration tests. In this article, we explain their principles and…
Text search with tsvector and raw SQL
It is very common to implement a feature of searching through the contents of the database. In one of the previous articles, we learned how to implement it in…
The data types to store money with PostgreSQL and Prisma
Managing money is a part of developing web applications that we can’t cut corners on. This article explores various data types built into PostgreSQL and Prisma…
The HTTPS protocol with Route 53 and AWS Certificate Manager
In the latest articles, we deployed our NestJS application using AWS. However, we’ve been exclusively using the HTTP protocol so far. You probably noticed that…
The OpenAPI specification and Swagger
Across this series, we emphasize code readability and maintainability. In part #52 of this course, we’ve gone through generating documentation with Compodoc…
Time intervals with the Drizzle ORM and PostgreSQL
Sometimes, in our application, we would like to define a specific duration of time. We could represent it as a number of seconds, for example. However, we…
Transactions with PostgreSQL and MikroORM
One of the most important things to care about as a web developer is the integrity of the data. In this article, we learn what a transaction is and how it can…
Two-factor authentication
While developing our application, security should be one of our main concerns. One of the ways we can improve it is by implementing a two-factor authentication…
Type-safe SQL queries with Kysely and PostgreSQL
Object-Relational Mapping (ORM) libraries such as Prisma and TypeORM can help us produce code faster by avoiding writing SQL queries. They have a smaller…
Understanding the injection scopes
When a NestJS application starts, it creates instances of various classes, such as controllers and services. By default, NestJS treats those classes as…
Unique IDs with UUIDs using Drizzle ORM and PostgreSQL
All rows in our database need unique identifiers, typically a sequence of numbers. Alternatively, we can use Universally Unique Identifiers (UUID). In this…
Unit tests with PostgreSQL and Kysely
Creating tests is essential when trying to build a robust and dependable application. In this article, we clarify the concept of unit tests and demonstrate how…
Unit tests with the Drizzle ORM
Unit tests play a significant role in ensuring the reliability of our NestJS application. In this article, we’ll explain the concept behind unit testing and…
Updating entities with PUT and PATCH using raw SQL queries
A significant thing to realize when developing a REST API is that HTTP methods are a matter of convention. For example, in theory, we could delete entities…
Updating with PUT and PATCH with MongoDB and Mongoose
When we develop a REST API, there is a set of HTTP methods that we can choose from, such as GET, POST, and DELETE. A crucial thing to understand is that HTTP…
Uploading and streaming videos
Nowadays, video streaming is one of the main ways of consuming and sharing content. In this article, we explore the fundamental concepts of building a REST API…
Uploading files to the server
So far, in this series, we’ve described two ways of storing files on a server. In the 10th article, we’ve uploaded files to Amazon S3. While it is very…
Uploading public files to Amazon S3
While storing files directly in the database is doable, it might not be the best approach. Files can take a lot of space, and it might impact the performance…
Using ETag to implement cache and save bandwidth
We’ve introduced various ways of caching files on the server throughout this series. This article teaches how to help the browser perform caching on the client…
Using multiple PostgreSQL schemas with Prisma
In PostgreSQL, schemas act as namespaces within the database and are containers for objects such as tables and indexes. In this article, we explain how they…
Using RabbitMQ to communicate with microservices
NestJS subscribes to the idea that a microservice is an application that uses a different transport layer than HTTP. Therefore, in the previous part of this…
Using server-side sessions instead of JSON Web Tokens
So far, in this series, we’ve used JSON Web Tokens (JWT) to implement authentication. While this is a fitting choice for many applications, this is not the…
Using Stripe to save credit cards for future use
With Stripe, we can build advanced custom payment flows. In this article, we continue looking into it and save credit cards for future use. To do that, we need…
Using the array data type with PostgreSQL and TypeORM
Storing arrays is not an obvious thing in the world of SQL databases. Solutions such as MySQL, MariaDB, or Microsoft SQL Server don’t have a straightforward…
Using UUID as primary keys with Prisma and PostgreSQL
Each record in our database should have a unique identifier. Typically, we use a numerical sequence to generate them. However, we can use an alternative…
Using various types of SQL joins
It’s a very common case to need to combine multiple related tables. In SQL, we can do that using a join statement. Therefore, this article explains various…
Using views with the Drizzle ORM and PostgreSQL
Our SQL queries can become more complex as the application we develop grows. To deal with that, PostgreSQL implements views that act as virtual tables with…
Verifying phone numbers and sending SMS messages with Twilio
In our web applications, we often need to send messages to our users. Doing that through email is enough in a lot of cases, but we can also use SMS. In this…
Virtual properties with MongoDB and Mongoose
In this series, we’ve used Mongoose to define properties in our schemas and work with models for documents. We’ve also defined various relations between…
What’s new in Express 5?
With NestJS 11, the framework now comes with Express 5 by default. While the update is mostly painless, there are some breaking changes to consider. In this…
Working with PostgreSQL using raw SQL queries
Object-Relational Mapping (ORM) libraries can often help us write our code faster. The ORM allows us not to write raw SQL. Instead, we can manipulate the data…
Working with transactions using raw SQL queries
One of the challenges when working with databases is keeping the integrity of the data. In this article, we learn how to deal with it using transactions. A…
Writing transactions with Prisma
As web developers, one of our primary concerns is keeping the integrity of our data. Fortunately, SQL databases come equipped with tools that allow us to…
Writing unit tests
Testing our application can increase our confidence when it comes to creating a fully-functional API. In this article, we look into how we can test our…
Writing unit tests in a project with raw SQL
Writing tests is crucial when aiming to develop a solid and reliable application. In this article, we explain the idea behind unit tests and write them for our…
Writing unit tests with Prisma
Covering our NestJS application with unit tests can help us create a reliable product. In this article, we introduce the idea behind unit tests and implement…