スキル一覧に戻る
HoangNguyen0403

nestjs-microservices

by HoangNguyen0403

nestjs-microservicesは、other分野における実用的なスキルです。複雑な課題への対応力を強化し、業務効率と成果の質を改善します。

111🍴 40📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: NestJS Microservices description: gRPC, RabbitMQ standards and Monorepo contracts. metadata: labels: [nestjs, microservices, grpc, rabbitmq] triggers: files: ['main.ts', '**/*.controller.ts'] keywords: [Transport.GRPC, Transport.RMQ, MicroserviceOptions]

Microservices & Transport Standards

Priority: P0 (FOUNDATIONAL)

Microservices communication patterns and transport layer standards.

  • Synchronous (RPC): Use gRPC for low-latency, internal service-to-service calls.
    • Why: 10x faster than REST/JSON, centralized .proto contracts.
  • Asynchronous (Events): Use RabbitMQ or Kafka for decoupling domains.
    • Pattern: Fire-and-forget (emit()) for side effects (e.g., "UserCreated" -> "SendEmail").

Monorepo Architecture

  • Contracts:
    • Pattern: Store all DTOs, .proto files, and Interfaces in a Shared Library (libs/contracts).
    • Rule: Services never import code from other services. They only import from contracts.
  • Versioning: Semantic versioning of messages is mandatory. Never change a field type; add a new field.

Exception Handling

  • Propagation: Standard HttpException is lost over Rpc/Tcp.

  • Standard: Use RpcException and generic Filters.

    // Global RPC Filter
    @Catch()
    export class RpcExceptionFilter implements RpcExceptionFilter<RpcException> {
      catch(exception: RpcException, host: ArgumentsHost): Observable<any> {
        return throwError(() => exception.getError());
      }
    }
    

Serialization

  • Message DTOs: Use class-validator just like HTTP.
    • Config: Apply useGlobalPipes(new ValidationPipe({ transform: true })) in the MicroserviceOptions setup, not just HTTP app setup.

スコア

総合スコア

85/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

+5
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

レビュー

💬

レビュー機能は近日公開予定です