react-template-data-access-endpoint

Community

Add typed API endpoints with safe mocks

Authortkorakas
Version1.0.0
Installs0

System Documentation

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.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: react-template-data-access-endpoint
Download link: https://github.com/tkorakas/react-template/archive/main.zip#react-template-data-access-endpoint

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.