{"id":13452611,"url":"https://github.com/graphql-kit/graphql-faker","last_synced_at":"2025-05-14T05:10:58.450Z","repository":{"id":37945216,"uuid":"83302827","full_name":"graphql-kit/graphql-faker","owner":"graphql-kit","description":"🎲 Mock or extend your GraphQL API with faked data. No coding required.","archived":false,"fork":false,"pushed_at":"2023-11-24T10:43:43.000Z","size":3697,"stargazers_count":2708,"open_issues_count":79,"forks_count":227,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-05-12T17:44:01.795Z","etag":null,"topics":["api","faked-data","faker","graphql","idl","mock"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-kit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"open_collective":"graphql-faker"}},"created_at":"2017-02-27T11:26:55.000Z","updated_at":"2025-05-08T13:25:53.000Z","dependencies_parsed_at":"2023-11-26T13:37:45.393Z","dependency_job_id":null,"html_url":"https://github.com/graphql-kit/graphql-faker","commit_stats":{"total_commits":361,"total_committers":30,"mean_commits":"12.033333333333333","dds":0.2936288088642659,"last_synced_commit":"297af86443267dc1f8ee918fd5c8ba7ec62f1150"},"previous_names":["apis-guru/graphql-faker","ivangoncharov/graphql-faker"],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-kit%2Fgraphql-faker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-kit%2Fgraphql-faker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-kit%2Fgraphql-faker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-kit%2Fgraphql-faker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-kit","download_url":"https://codeload.github.com/graphql-kit/graphql-faker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253871687,"owners_count":21976739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","faked-data","faker","graphql","idl","mock"],"created_at":"2024-07-31T07:01:29.103Z","updated_at":"2025-05-14T05:10:58.392Z","avatar_url":"https://github.com/graphql-kit.png","language":"TypeScript","funding_links":["https://opencollective.com/graphql-faker"],"categories":["TypeScript","Projects using `@faker-js/faker`"],"sub_categories":[],"readme":"![GraphQL Faker logo](./docs/faker-logo-text.png)\n\n# GraphQL Faker\n\n[![Build Status](https://github.com/graphql-kit/graphql-faker/workflows/CI/badge.svg?branch=master)](https://github.com/graphql-kit/graphql-faker/actions?query=branch%3Amaster)\n[![npm](https://img.shields.io/npm/v/graphql-faker.svg)](https://www.npmjs.com/package/graphql-faker)\n[![David](https://img.shields.io/david/graphql-kit/graphql-faker.svg)](https://david-dm.org/graphql-kit/graphql-faker)\n[![David](https://img.shields.io/david/dev/graphql-kit/graphql-faker.svg)](https://david-dm.org/graphql-kit/graphql-faker?type=dev)\n[![npm](https://img.shields.io/npm/l/graphql-faker.svg)](https://github.com/graphql-kit/graphql-faker/blob/master/LICENSE)\n[![docker](https://img.shields.io/docker/build/apisguru/graphql-faker.svg)](https://hub.docker.com/r/apisguru/graphql-faker/)\n\nMock your future API or extend the existing API with realistic data from [faker.js](https://fakerjs.dev/). **No coding required**.\nAll you need is to write [GraphQL SDL](https://alligator.io/graphql/graphql-sdl/). Don't worry, we will provide you with examples in our SDL editor.\n\nIn the GIF below we add fields to types inside real GitHub API and you can make queries from GraphiQL, Apollo, Relay, etc. and receive **real data mixed with mock data.**\n![demo-gif](./docs/demo.gif)\n\n## How does it work?\n\nWe use `@fake` directive to let you specify how to fake data. And if 60+ fakers is not enough for you, just use `@examples` directive to provide examples. Use `@listLength` directive to specify number of returned array items. Add a directive to any field or custom scalar definition:\n\n    type Person {\n      name: String @fake(type: firstName)\n      gender: String @examples(values: [\"male\", \"female\"])\n      pets: [Pet] @listLength(min: 1, max: 10)\n    }\n\nNo need to remember or read any docs. Autocompletion is included!\n\n## Features\n\n- 60+ different types of faked data e.g. `streetAddress`, `firstName`, `lastName`, `imageUrl`, `lorem`, `semver`\n- Comes with multiple locales supported\n- Runs as a local server (can be called from browser, cURL, your app, etc.)\n- Interactive editor with autocompletion for directives with GraphiQL embedded\n- ✨ Support for proxying existing GraphQL API and extending it with faked data\n  ![Extend mode diagram](./docs/extend-mode.gif)\n\n## Install\n\n    npm install -g graphql-faker\n\nor run it in a Docker container, see **Usage with Docker**\n\n## TL;DR\n\nMock GraphQL API based on example SDL and open interactive editor:\n\n    graphql-faker --open\n\n**Note:** You can specify non-existing SDL file names - Faker will use example SDL which you can edit in interactive editor.\n\nExtend real data from SWAPI with faked data based on extension SDL:\n\n    graphql-faker ./ext-swapi.graphql --extend http://swapi.apis.guru\n\nExtend real data from GitHub API with faked data based on extension SDL (you can get token [here](https://developer.github.com/early-access/graphql/guides/accessing-graphql/#generating-an-oauth-token)):\n\n    graphql-faker ./ext-gh.graphql --extend https://api.github.com/graphql \\\n    --header \"Authorization: bearer \u003cTOKEN\u003e\"\n\n## Usage\n\n    graphql-faker [options] [SDL file]\n\n`[SDL file]` - path to file with [SDL](https://alligator.io/graphql/graphql-sdl/). If this argument is omitted Faker uses default file name.\n\n### Options\n\n- `-p`, `--port` HTTP Port [default: `env.PORT` or `9002`]\n- `-e`, `--extend` URL to existing GraphQL server to extend\n- `-o`, `--open` Open page with SDL editor and GraphiQL in browser\n- `-H`, `--header` Specify headers to the proxied server in cURL format, e.g.: `Authorization: bearer XXXXXXXXX`\n- `--forward-headers` Specify which headers should be forwarded to the proxied server\n- `--co`, `--cors-origin` CORS: Specify the custom origin for the Access-Control-Allow-Origin header, by default it is the same as `Origin` header from the request\n- `-h`, `--help` Show help\n\nWhen specifying the `[SDL file]` after the `--forward-headers` option you need to prefix it with `--` to clarify it's not another header. For example:\n\n```\ngraphql-faker --extend http://example.com/graphql --forward-headers Authorization -- ./temp.faker.graphql\n```\n\nWhen you finish with an other option there is no need for the `--`:\n\n```\ngraphql-faker --forward-headers Authorization --extend http://example.com/graphql ./temp.faker.graphql\n```\n\n### Usage with Docker\n\n    docker run -p=9002:9002 apisguru/graphql-faker [options] [SDL file]\n\nTo specify a custom file, mount a volume where the file is located to `/workdir`:\n\n    docker run -v=${PWD}:/workdir apisguru/graphql-faker path/to/schema.sdl\n\nBecause the process is running inside of the container, `--open` does not work.\n\n# Development\n\n```sh\nnpm i\nnpm run build\nnpm run start\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-kit%2Fgraphql-faker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-kit%2Fgraphql-faker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-kit%2Fgraphql-faker/lists"}