backend-trpc-openapi

Generate REST endpoints and OpenAPI documentation from tRPC routers.

13|2|Updated Aug 9, 2025
One-click install
npx skills add https://github.com/petbrains/mvp-builder --skill backend-trpc-openapi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-trpc-openapi
Source: https://github.com/petbrains/mvp-builder/tree/main/.claude/skills/backend-trpc-openapi
Command: npx skills add https://github.com/petbrains/mvp-builder --skill backend-trpc-openapi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Generates REST endpoints and OpenAPI docs from tRPC routers for external consumption.

Core Features & Use Cases

  • Auto-generated Swagger/OpenAPI specs
  • Type-safe REST adapters
  • Documentation for third parties

Quick Start

Install trpc-to-openapi and annotate routers; generate OpenAPI docs.

Frequently Asked Questions about backend-trpc-openapi

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

FAQPage Schema
How do I generate REST endpoints from tRPC routers?

REST endpoints from tRPC routers are generated using the trpc-to-openapi package, which converts your type-safe tRPC procedures into standard REST endpoints. Install trpc-to-openapi, annotate your routers with metadata, and the package automatically produces both the endpoints and OpenAPI documentation. This enables third-party consumption and cross-language interoperability without manually defining REST contracts.

Can I create OpenAPI documentation from my tRPC API?

Yes. OpenAPI documentation is auto-generated from your tRPC routers using trpc-to-openapi, which produces both a machine-readable OpenAPI spec and an interactive Swagger UI. This standardized documentation makes your API accessible to third-party developers, mobile apps, and tools that consume REST APIs, without duplicating your type definitions.

What versions of tRPC and what dependencies do I need?

You need tRPC v11 or later and Zod for schema validation. The trpc-to-openapi package handles the conversion from tRPC routers to REST endpoints and OpenAPI specs. These are the core technical requirements; no additional dependencies are listed as hard constraints for the base workflow.

How do I serve REST endpoints alongside my tRPC backend?

REST endpoints are served via an Express-compatible middleware generated by trpc-to-openapi. After generating the middleware from your annotated tRPC routers, mount it on your Express app to expose REST routes. This allows existing tRPC clients to coexist with REST consumers on the same backend.

Can I use this if I need REST fallbacks for mobile or public APIs?

Yes. This Skill is designed for internal tRPC apps that require REST interfaces for third-party consumption, mobile clients, or public API access. It eliminates the need to maintain separate REST adapters by deriving REST endpoints and OpenAPI specs directly from your type-safe tRPC definitions.