Category: JavaScript

JavaScript NestJS TypeScript

API with NestJS #27. Introduction to GraphQL. Queries, mutations, and authentication

This entry is part 27 of 33 in the API with NestJS

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 looking into. At its core, GraphQL is a query language with a runtime that can execute them. Although it is an alternative to REST, it can work alongside it. […]

JavaScript NestJS TypeScript

API with NestJS #26. Real-time chat with WebSockets

This entry is part 26 of 33 in the API with NestJS

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 server and listen to information from the other side. The principles of the WebSocket handshake WebSocket is a protocol that operates in a different way than HTTP. Even though […]

JavaScript NestJS TypeScript

API with NestJS #23. Implementing in-memory cache to increase the performance

This entry is part 23 of 33 in the API with NestJS

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 make our API even more performant, we might want to completely avoid running some of the code. Accessing the data stored in the database is quite often time-consuming. […]

JavaScript NestJS TypeScript

API with NestJS #22. Storing JSON with PostgreSQL and TypeORM

This entry is part 22 of 33 in the API with NestJS

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 flexibility, though. Chances are you already know JSON and use it in your web applications. There are databases like MongoDB that store JSON-like documents. With this approach, we can describe […]


Dealing with some CSRF attacks using the SameSite cookies

Keeping our tokens in cookies can have significant advantages over using the Web Storage API. If we use the HttpOnly attribute, we can’t access the cookies through JavaScript. That means that any malicious code won’t be able to do that too. In the above scenario, we assume that the browser automatically sends the cookies when […]

JavaScript NestJS TypeScript

API with NestJS #21. An introduction to CQRS

This entry is part 21 of 33 in the API with NestJS

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, there are other possibilities to look into. NestJS suggests command-query responsibility segregation (CQRS). In this article, we look into this concept and implement it into our application. Instead of keeping […]

JavaScript NestJS TypeScript

API with NestJS #20. Communicating with microservices using the gRPC framework

This entry is part 20 of 33 in the API with NestJS

With NestJS, we have quite a few transport layer implementations prepared for microservices. Among them, the gRPC transporter is definitely one of the most interesting. In this article, we explore the idea and implement it with NestJS. gRPC is, at its core, a Remote Procedure Call (RPC) framework. Its main idea revolves around creating services […]

JavaScript NestJS TypeScript Uncategorized

API with NestJS #19. Using RabbitMQ to communicate with microservices

This entry is part 19 of 33 in the API with NestJS

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 series, we’ve used TCP. However, with NestJS, we have a broad selection of transporters that transmit messages across microservices. Each one of them is different, and it is worth exploring […]