rest-to-graphql-migrator

Migrates REST APIs to GraphQL incrementally using schema stitching and REST data sources.

Updated Aug 28, 2026
One-click install
npx skills add https://github.com/Yash-Awasthi/adapfit --skill rest-to-graphql-migrator-yash-awasthi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rest-to-graphql-migrator
Source: https://github.com/Yash-Awasthi/adapfit/tree/main/.agents/skills/rest-to-graphql-migrator
Command: npx skills add https://github.com/Yash-Awasthi/adapfit --skill rest-to-graphql-migrator-yash-awasthi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rewriting a production REST API as GraphQL in one shot is risky and disruptive. This Skill guides an incremental migration that wraps existing REST endpoints behind a GraphQL layer, so existing clients keep working while new consumers adopt GraphQL. ## Core Features & Use Cases - REST Data Source Wrapping: Implements Apollo RESTDataSource classes with auth headers, caching, and cache invalidation on mutations. - Schema and Resolver Generation: Maps REST endpoints to GraphQL types, queries, and mutations, including data transformers between snake_case REST payloads and camelCase GraphQL fields. - N+1 Prevention and Error Mapping: Uses DataLoader for batched resolution and maps HTTP status codes to GraphQL error codes like UNAUTHENTICATED and NOT_FOUND. - Use Case: A team with a large Express REST API wants GraphQL for a new mobile app. They wrap users, posts, and comments endpoints with RESTDataSource, stitch subschemas into a gateway, then migrate hot paths to direct database access phase by phase. ## Quick Start Ask the assistant to migrate your REST API to GraphQL incrementally, starting by wrapping your existing endpoints with Apollo RESTDataSource and generating the corresponding schema and resolvers.

Frequently Asked Questions about rest-to-graphql-migrator

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

FAQPage Schema
How do I migrate a REST API to GraphQL without breaking clients?▼

Wrap existing REST endpoints with Apollo RESTDataSource and expose them through a GraphQL schema, so current clients keep calling REST. Then migrate endpoints incrementally, moving hot paths to direct database access and deprecating REST routes gradually.

How to wrap REST endpoints with Apollo RESTDataSource?▼

Extend RESTDataSource, set baseURL to your REST API, and implement methods like get, post, patch, and delete per endpoint. Override willSendRequest to attach auth headers, and pass cacheOptions to cache GET responses.

How do I prevent N+1 queries when GraphQL resolvers call REST APIs?▼

Use DataLoader to batch and cache per-request REST calls in nested resolvers. If the REST API offers a batch endpoint, load all IDs in one request; otherwise issue parallel individual calls inside the loader.

Should I choose wrapper, gradual, or rewrite strategy for GraphQL migration?▼

Wrapper suits quick starts with no backend changes, gradual fits large production APIs migrated endpoint by endpoint, and full rewrite only makes sense for greenfield opportunities. Most production systems should start with the wrapper approach.

How are REST HTTP errors mapped to GraphQL errors?▼

Catch errors from the data source and throw GraphQLError with extensions codes: 400 becomes BAD_USER_INPUT, 401 UNAUTHENTICATED, 403 FORBIDDEN, 404 NOT_FOUND, and 409 CONFLICT. This gives clients consistent, typed error handling.