Mock GraphQL Response Generator

Fake GraphQL query responses for frontend dev

Ad placeholder (leaderboard)

Mock GraphQL Response Generator

When you are building a frontend against a GraphQL API that does not exist yet, you need response data that matches the real shape: the data envelope, nested objects, lists, and pagination metadata. This tool generates that JSON for you so you can wire up components, loading states, and pagination controls before the backend is ready.

How it works

Every GraphQL response is a JSON object with a top-level data key whose properties mirror the query selection set. The generator builds data[rootField] according to your configuration. For a plain list it emits an array of objects with an id, a name-like string, and a few typed fields. For a Relay-style connection it wraps the items in an edges array, where each entry has a node and a cursor, alongside a pageInfo object.

Cursors follow the common Relay convention: the string cursor:N for item index N, base64-encoded so it reads as an opaque token. The pageInfo.endCursor is the last item’s cursor and hasNextPage is set when the requested count fills the page, mirroring how a real resolver paginates.

Tips and notes

  • Use the connection option when your UI uses infinite scroll or cursor pagination; use the plain list otherwise.
  • The output is spec-valid JSON, so it drops straight into Apollo MockedProvider, MSW handlers, or fixture files.
  • Decode a cursor in your console with atob("...") to confirm it reads cursor:N.
  • Increase the item count to stress-test rendering and virtualization in long lists.
Ad placeholder (rectangle)