server-side-calls

Call tRPC procedures from server-side code using createCallerFactory and router.createCaller().

Updated Jun 26, 2025
One-click install
npx skills add https://github.com/flaviogragnolati/coco --skill server-side-calls-flaviogragnolati
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: server-side-calls
Source: https://github.com/flaviogragnolati/coco/tree/main/.agents/skills/server-side-calls
Command: npx skills add https://github.com/flaviogragnolati/coco --skill server-side-calls-flaviogragnolati

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @trpc/server, and includes scripts (resource) components.

What problem does it solve?

This Skill unit addresses the need for server-side execution of tRPC procedures, enabling seamless integration and testing within server-side code, and facilitates custom API endpoint development with comprehensive error handling.

Core Features & Use Cases

  • Server-Side tRPC Calls: Directly call tRPC procedures from server code for internal logic and custom API endpoints.
  • Error Handling: Efficiently manage TRPC errors and extract HTTP status codes for proper error response handling.
  • Integration Testing: Facilitate easy integration testing using createCallerFactory and router.createCaller() for comprehensive server-side logic testing.
  • Use Case: Create a custom API endpoint that interacts with the server's data without manual intervention, simplifying the testing process.

Quick Start

Integrate the server-side calls Skill into your tRPC setup to make direct tRPC procedure calls within your server-side code using the createCallerFactory and router.createCaller() functions.

Frequently Asked Questions about server-side-calls

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

FAQPage Schema
How do I call tRPC procedures directly from server-side code?

You can execute tRPC procedures from server-side code by using the createCallerFactory function and router.createCaller() to invoke internal logic directly. This facilitates custom endpoint development and server-side integration.

How do I handle tRPC errors and extract HTTP status codes for API responses?

Handling tRPC errors involves efficiently managing TRPC error outputs and extracting HTTP status codes to ensure proper error response handling. This allows your custom API endpoints to return accurate HTTP responses when server-side calls fail.

What is the best way to test tRPC router procedures on the server?

The best way to test tRPC router procedures is through integration testing using createCallerFactory and router.createCaller() functions. This provides comprehensive server-side logic testing by simulating context-aware procedure calls.

Does this server-side tRPC calling method require a specific version?

Yes, this server-side tRPC calling method requires a setup with tRPC version 11.16.0. You also need the @trpc/server dependency installed to enable context-aware call factories and router functions properly.

Can I create custom API endpoints that interact with tRPC server data?

Yes, you can create custom API endpoints that interact with tRPC server data by calling tRPC procedures directly within your server-side code. This simplifies data interaction without manual data fetching or endpoint duplication.