react-template-data-access-endpoint

Integrate React+TypeScript backend endpoints with Zod schemas and synchronized Mockoon mocks.

11|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/tkorakas/react-template --skill react-template-data-access-endpoint
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-template-data-access-endpoint
Source: https://github.com/tkorakas/react-template/tree/main/.agents/skills/react-template-data-access-endpoint
Command: npx skills add https://github.com/tkorakas/react-template --skill react-template-data-access-endpoint

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Eliminates mismatches between frontend API usage and backend contracts by centralizing request and response parsing, aligning mocks, and removing ad-hoc httpClient calls to prevent runtime type errors and flaky local development.

Core Features & Use Cases

  • Zod schema creation: Define request and response contracts in src/data-access/<feature>/<feature>.schema.ts to validate payloads and responses.
  • Typed API functions: Implement exported API functions in src/data-access/<feature>/<feature>.api.ts that call the http client and parse responses before returning.
  • Mock synchronization: Update mocks/api.mockoon.json to reflect endpoint paths and response shapes so local dev mirrors contract expectations.
  • Refactor callers: Replace direct httpClient usage in feature code with imports from the feature-specific data-access module to keep feature logic focused on orchestration.
  • Use case: Adding a new POST /api/team-members endpoint with typed parsing and aligned mocks for local testing.

Quick Start

Create feature-scoped Zod schemas and an exported API function, update mocks/api.mockoon.json to match the contract, and replace feature httpClient calls with imports from the new data-access module so pnpm type-check passes.

Frequently Asked Questions about react-template-data-access-endpoint

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

FAQPage Schema
How do I type and validate API responses in a React TypeScript project?

To type and validate API responses in a React TypeScript project, define Zod request and response schemas in feature-scoped modules and parse HTTP client results through them. This centralizes request and response parsing to prevent runtime type errors.

What is the best way to synchronize local API mocks with frontend contracts?

The best way to synchronize local API mocks with frontend contracts is to align Mockoon mock entries with Zod schema definitions. Updating mocks/api.mockoon.json to reflect endpoint paths and response shapes ensures local development mirrors contract expectations.

How do I remove direct httpClient calls from React feature code?

To remove direct httpClient calls from React feature code, replace them with imports from feature-specific data-access modules. Exported API functions in src/data-access/<feature>/<feature>.api.ts handle HTTP calls and response parsing, keeping feature logic focused on orchestration.

Does this data-access approach work with Mockoon for local endpoint testing?

Yes, this data-access approach works with Mockoon by updating mocks/api.mockoon.json to match endpoint paths and response shapes. Aligned Mockoon entries allow local development to mirror backend contract expectations for safe local testing.

Why do I need Zod schemas for API data access in TypeScript?

You need Zod schemas for API data access in TypeScript to eliminate mismatches between frontend usage and backend contracts. Defining request and response contracts in Zod validates payloads and responses, preventing runtime type errors and flaky local development.