NestJS

API with NestJS #169. Unique IDs with UUIDs using Drizzle ORM and PostgreSQL

This entry is part 169 of 170 in the API with NestJS

All rows in our database need unique identifiers, typically a sequence of numbers. Alternatively, we can use Universally Unique Identifiers (UUID). In this article, we explore the pros and cons of UUIDs and show how to implement them in a project that uses NestJS, PostgreSQL, and the Drizzle ORM. Introducing UUIDs At this point, we’re […]

Uncategorized

API with NestJS #168. Integration tests with the Drizzle ORM

This entry is part 168 of 170 in the API with NestJS

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 the Drizzle ORM. Unit tests help us check if a particular class of a single function functions properly on its own. While unit tests are important, they are […]

NestJS

API with NestJS #167. Unit tests with the Drizzle ORM

This entry is part 167 of 170 in the API with NestJS

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 learn how to apply it to a NestJS application with the Drizzle ORM. Introduction to unit tests Unit tests allow us to verify that individual parts of our codebase function […]

NestJS

API with NestJS #166. Logging with the Drizzle ORM

This entry is part 166 of 170 in the API with NestJS

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 that, implementing logging functionality is necessary to track down and investigate any potential problems. In this article, we learn how to use the logger built into NestJS and integrate it […]

NestJS SQL

API with NestJS #163. Full-text search with the Drizzle ORM and PostgreSQL

This entry is part 163 of 170 in the API with NestJS

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 most relevant matches first. In this article, we learn how to implement it with the Drizzle ORM, PostgreSQL, and NestJS. Column types used with the text-search feature To implement […]

NestJS

API with NestJS #162. Identity columns with the Drizzle ORM and PostgreSQL

This entry is part 162 of 170 in the API with NestJS

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 in PostgreSQL was with the serial type. However, nowadays, the official documentation advises against them. In this article, we compare the serial type and its alternative, the […]

JavaScript

API with NestJS #161. Generated columns with the Drizzle ORM and PostgreSQL

This entry is part 161 of 170 in the API with NestJS

In SQL, generated columns automatically calculate their values using data from other fields in the same table. This can help ensure data consistency, improve query performance, and simplify our database design in general. The SQL standard contains two types of generated columns. Virtual generated columns With virtual generated columns, we avoid using additional disk storage. […]