Category: TypeScript

NestJS

API with NestJS #166. Logging with the Drizzle ORM

This entry is part 166 of 166 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 166 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 166 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 […]

NestJS

API with NestJS #158. Soft deletes with the Drizzle ORM

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

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 use soft deletes to keep the deleted entities in our database. In this article, we learn how to do it using the Drizzle ORM and PostgreSQL. Introducing soft deletes To […]

NestJS

API with NestJS #157. Handling JSON data with PostgreSQL and the Drizzle ORM

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

PostgreSQL is well-suited for handling structured data and keeping everything organized and consistent. On the other hand, MongoDB stores data in flexible JSON-like documents, making it ideal for data with varying attributes and changing requirements. While SQL databases have many advantages, there are times when flexibility is needed. Fortunately, PostgreSQL bridges this gap by allowing […]

NestJS

API with NestJS #156. Arrays with PostgreSQL and the Drizzle ORM

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

Thanks to some of its features, PostgreSQL sets itself apart from other SQL databases. Unlike many SQL databases that limit columns to single entries, PostgreSQL lets us store multiple values in a single column. This simplifies database design and can improve performance. In this article, we will explore the practical uses of arrays in PostgreSQL […]

NestJS

API with NestJS #155. Offset and keyset pagination with the Drizzle ORM

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

As our database grows, maintaining good performance becomes more important. Returning large amounts of data at once through our API can negatively affect efficiency. A common solution is to divide data into smaller chunks, presenting it to the user as infinite scrolling or multiple pages. In this article, we implement this approach using PostgreSQL and […]