Series: API with NestJS

SQL

API with NestJS #121. Many-to-one relationships with PostgreSQL and Kysely

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

Designing relationships is one of the crucial aspects of working with SQL databases. In this article, we continue using Kysely with NestJS and implement many-to-one relationships. Check out this repository if you want to see the full code from this article. Introducing the many-to-one relationship When implementing the many-to-one relationship, a row from the first table […]

NestJS SQL

API with NestJS #122. Many-to-many relationships with Kysely and PostgreSQL

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

Implementing relationships across tables is a crucial aspect of working with SQL databases. So far, this series covers using Kysely to design simple relationships such as one-to-one and many-to-one. This article looks into many-to-many, which is a slightly more advanced relationship. Check out this repository if you want to see the full code from this […]

NestJS SQL

API with NestJS #123. SQL transactions with Kysely

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

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 consistency and accuracy of our data. You can see the complete code from this article in this repository. One of the critical situations to consider is […]

NestJS SQL

API with NestJS #124. Handling SQL constraints with Kysely

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

When using SQL databases, we can set constraints to ensure our data remains accurate and reliable during insertions, updates, or deletions. In this article, we’ll explore different SQL constraints and demonstrate how to apply them using Kysely and NestJS to maintain data integrity. Check out this repository for the full code from this article. Not-null […]

NestJS SQL

API with NestJS #125. Offset and keyset pagination with Kysely

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

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 approach is to query the data in parts and present the users with separate pages or infinite scrolling. We implement pagination in this article with NestJS, PostgreSQL, […]

NestJS SQL

API with NestJS #127. Arrays with PostgreSQL and Kysely

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

PostgreSQL outshines various other SQL databases with its feature set. Unlike most SQL databases, PostgreSQL offers extensive support for array columns. Using them, we can store collections of values within a single column without creating separate tables. In this article, we explore the capabilities of arrays in PostgreSQL and implement examples using Kysely. Creating the […]

NestJS SQL

API with NestJS #128. Managing JSON data with PostgreSQL and Kysely

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

PostgreSQL is great for structured data and is known for its reliability in maintaining data organization and consistency. On the other hand, MongoDB stores data in flexible JSON-like documents, making it ideal for data with varying attributes and evolving requirements. Using SQL has a lot of advantages over MongoDB, but we might need some flexibility […]

NestJS SQL

API with NestJS #129. Implementing soft deletes with SQL and Kysely

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

When working on our REST APIs, we usually focus on implementing the four fundamental operations: creating, reading, updating, and deleting (CRUD). Deleting entities is a common feature in many web applications. The simplest way to do it is by permanently deleting rows from the database. In this article, we use Kysely to explore the idea […]

NestJS

API with NestJS #130. Avoiding storing sensitive information in API logs

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

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 services. However, they can pose security and privacy risks when misused. In this article, we will learn how to prevent sensitive information from being stored in our logs. Logging […]