Nestjs Json Rpc

screenshot of Nestjs Json Rpc
express

A JSON-RPC microservice strategy implementation for NestJS

Overview

The nestjs-json-rpc package offers an efficient and scalable way to implement JSON-RPC microservices within a NestJS application. Designed to utilize HTTP as the primary transport layer, it provides a well-structured approach to building microservice architectures. With its flexible features and robust integration capabilities, this package is the perfect choice for developers looking to enhance their application with JSON-RPC functionality.

What sets nestjs-json-rpc apart is its capacity to enable a seamless hybrid mode, allowing developers to run JSON-RPC alongside other endpoints on the same port. This versatility, combined with comprehensive support for testing, security checks, and custom data management, makes it a powerful tool for developers who prioritize both performance and code clarity.

Features

  • Simple Initialization: Easily integrate nestjs-json-rpc by initializing it with a JsonRpcService as the strategy option, similar to standard microservices.

  • Decorator Support: Enhance your services with @RpcService and @RpcMethod decorators, automating method registration based on namespace conventions.

  • Hybrid Mode Capability: Run JSON-RPC endpoints alongside existing NestJS applications on the same port, allowing for easy coexistence with health check endpoints.

  • Client Creation: Generate proxy clients effortlessly in any service, with customizable headers for every request, including authorization tokens.

  • Robust E2E Testing: Utilize super-test for end-to-end testing without the need for spinning up an HTTP server, streamlining your testing process.

  • Custom Context Management: Leverage JsonRpcContext for type-safe storage and retrieval of custom data, enhancing the management of contextual information within requests.

  • Error Transformation: Automatically transform errors into appropriate CodedRpcExceptions to ensure consistent error handling across your microservices.

  • Metadata Access: Gain access to additional metadata, such as request headers, within your application context, making it easier to manage authentication and authorization seamlessly.

express
Express

Express.js is a simple Node.js framework for single, multi-page, and hybrid web applications.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.