gateway-endpoint

Expose REST endpoints that delegate to typed gRPC clients in .NET gateway controllers.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill gateway-endpoint
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gateway-endpoint
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/microservice/gateway/gateway-endpoint
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill gateway-endpoint

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill documents patterns and best practices for building REST gateway controllers that reliably delegate to gRPC backend services, preventing leaking proto types into REST responses and reducing duplicated mapping logic.

Core Features & Use Cases

  • Versioned controller base: Enforce a ControllerBaseV1 that centralizes route constants and OpenAPI grouping for consistent API surface across gateways.
  • Constructor-injected gRPC clients: Recommend primary constructor injection with backing readonly fields for typed gRPC clients to keep controllers thin and testable.
  • Inline mapping and response models: Map gRPC responses to REST DTOs inline, use Paginated<T> for list endpoints, and wrap command results in a simple Response { Message } model.
  • Error handling and security: Provide RpcException handling patterns, rely on global filters for most errors, and apply class-level Authorize attributes with Policy or Roles.

Quick Start

Add a new controller that inherits ControllerBaseV1, injects the typed gRPC client in the constructor, maps responses to REST DTOs inline, and returns Paginated<T> for list endpoints.

Frequently Asked Questions about gateway-endpoint

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I map REST controllers to gRPC backend services in .NET?

You can map REST controllers to gRPC backends by inheriting ControllerBaseV1, injecting typed gRPC clients through the constructor, and returning REST DTOs mapped inline from proto responses to prevent leaking internal types.

What is the best way to prevent proto types from leaking into REST API responses?

The best way to prevent proto types from leaking into REST responses is to apply inline mapping within your gateway controllers, translating gRPC response types into dedicated REST DTOs before returning them to the client.

How should I handle RpcException errors when delegating REST calls to gRPC clients?

Handle RpcException errors by implementing dedicated error handling strategies in your gateway controllers, relying on global filters for general errors to maintain consistent REST API behavior.

Do I need ControllerBaseV1 to build a .NET REST to gRPC gateway?

Using ControllerBaseV1 is recommended for .NET REST to gRPC gateways because it centralizes route constants and OpenAPI grouping, enforcing a consistent API surface across all gateway controllers.

How do I return paginated lists from a REST endpoint backed by a gRPC service?

Return paginated lists from a gRPC-backed REST endpoint by wrapping list results in a Paginated<T> wrapper, ensuring the REST API delivers standardized pagination metadata to clients.