Posts

Showing posts with the label microservices

Guide to integrating NextJS with gRPC and NestJS via HTTP/2

Image
Introduction gRPC is a high-performance RPC (Remote Procedure Call) framework developed by Google, using Protocol Buffers (protobuf) as the interface definition language and data serialization format. Unlike traditional REST which uses text (JSON), gRPC transmits data in binary format to optimize payload size and processing speed. In particular, gRPC operates based on HTTP/2, providing outstanding advantages such as: Multi-plexing (sending multiple concurrent requests over a single connection), Header Compression, and Server Push, helping to reduce latency and increase bandwidth for microservices systems. In this article, I will use NextJS for the frontend and act as a BFF (Backend For Frontend) as a proxy server to aggregate information and communicate via HTTP/2 gRPC with the NestJS server. Our connection will be as follows: Frontend connects to NextJS proxy server using restful api HTTP/1.1, NextJS connects to NestJS using gRPC via HTTP/2, we need a NextJS middleware to handle it, n...

NestJS Practice Series

Image
Introduction NestJS is a progressive NodeJS framework designed for building efficient, reliable, and scalable server-side applications. Built on top of TypeScript (but also supporting pure JavaScript), NestJS combines elements of Object-Oriented Programming (OOP), Functional Programming (FP), and Functional Reactive Programming (FRP). The outstanding advantages of NestJS include: Modular architecture: Helps organize code scientifically, easy to maintain and expand for large projects. Powerful TypeScript support: Fully leverage static typing to minimize errors during development. Flexibility: Allows easy integration with other libraries (like Express or Fastify) and supports a wide variety of communication protocols (REST, GraphQL, WebSockets, Microservices). Rich ecosystem: Provides ready-to-use tools for processing common tasks like Validation, Caching, Database mapping (TypeORM/Prisma), and Authentication. Dependency Injection: A powerful mechanism that helps manage...