{"id":18459870,"url":"https://github.com/sayjava/graphql-sample","last_synced_at":"2025-04-23T18:13:32.169Z","repository":{"id":38174452,"uuid":"276941323","full_name":"sayjava/graphql-sample","owner":"sayjava","description":"Zero Coding, ⚡ Rapid GraphQL Sample Data Generator and API","archived":false,"fork":false,"pushed_at":"2023-01-06T10:33:00.000Z","size":1106,"stargazers_count":2,"open_issues_count":23,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T18:13:28.034Z","etag":null,"topics":["data-generator","faker","graphql","prototype","sample-data"],"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/sayjava.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-03T16:17:31.000Z","updated_at":"2022-10-31T22:27:58.000Z","dependencies_parsed_at":"2023-02-05T21:31:04.437Z","dependency_job_id":null,"html_url":"https://github.com/sayjava/graphql-sample","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayjava%2Fgraphql-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayjava%2Fgraphql-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayjava%2Fgraphql-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayjava%2Fgraphql-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sayjava","download_url":"https://codeload.github.com/sayjava/graphql-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250487536,"owners_count":21438612,"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":["data-generator","faker","graphql","prototype","sample-data"],"created_at":"2024-11-06T08:24:44.204Z","updated_at":"2025-04-23T18:13:32.152Z","avatar_url":"https://github.com/sayjava.png","language":"TypeScript","readme":"\u003ch1 align=\"center\" style=\"border-bottom: none;\"\u003e⚡ graphql-sample ⚡\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\u003cp align=\"center\"\u003e\n    Zero Coding, ⚡ Rapid GraphQL API prototyping\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"#\"\u003e\n\u003cimg src=\"https://github.com/sayjava/graphql-sample/workflows/test/badge.svg\" alt=\"CI Status\"\u003e\n\u003cimg src=\"https://badge.fury.io/js/graphql-sample.svg\" alt=\"CI Status\"\u003e\n\n\u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n- Zero coding required\n- CRUD API for each defined type in the schema definition\n- MongoDB/Hasura style filtering API\n- Use your own sample data\n\n## Quick Start\n\nCreate a type definition file and name it `schema.graphql` with the following content\n\n```graphql\ntype User {\n  userid: ID # Auto-generated IDs\n  firstName: String @named(as: \"name_firstName\")\n  lastName: String @named(as: \"name_lastName\")\n\n  votes: [Vote!] @relation\n}\n\ntype Vote {\n  voteId: Int @unique # Auto-generated IDs\n  timestamp: String @named(as: \"date_recent\")\n  total: Int @nameD(as: \"random_number\")\n\n  user: User @relation\n}\n```\n\nand in the same folder run\n\n```sh\nnpx graphql-sample\n```\n\nThe GraphQL server will be running at `http://localhost:8080/graphql`. It comes with an IDE to query in the browser or use `HTTP POST`\n\nand you can run a sample query like\n\n```graphql\n{\n  findUsers(limit: 2) {\n    firstName\n    lastName\n\n    votes(where: { total: { gt: 400 } }) {\n      total\n      timestamp\n    }\n  }\n}\n```\n\nor create a new user like\n\n```graphql\nmutation {\n  createUsers(data: [{ userid: 2, firstName: \"james\", lastName: \"bond\" }]) {\n    users {\n      firstName\n    }\n  }\n}\n```\n\n## Usage \u0026 Options\n\n```sh\nnpx graphql-sample --help\n```\n\n## Generating Sample Data\n\n`graphql-sample` uses the wonderful [faker.js](https://github.com/marak/Faker.js/) underneath to generate sample data for the type fields using the format `@named(as: \"namespace_function\")` where namespace can be e.g `name` and function can be `firstName`\n\nSee the full list of available faker.js functions here at [faker.js namespaces and functions](https://rawgit.com/Marak/faker.js/master/examples/browser/index.html)\n\n`namespace_function` examples are: -\n\n- address_country\n- commerce_department\n- company_bs\n- date_past\n- finance_iban\n- internet_email\n- image_city\n\nSee [faker.js namespaces and functions](https://rawgit.com/Marak/faker.js/master/examples/browser/index.html)\n\nAny field defined as an `ID` or with `@unique` directive will be auto-generated\n\n## Advance Usage\n\n### Relationships\n\nYou can use the `@relation` directive to create a relationship between two types. Each type must have at least one unique field using `@unique` or `GraphQL ID`\n\n### BYOD (bring your own data)\n\nif you would rather use your own sample data, any `json` or `csv` file in the same directory as your schema file can be referenced in your type definition.\n\nFor example, if you have a csv file in the same folder as your schema named `users.csv` with the following content\n\n| id  | name  | title   |\n| --- | ----- | ------- |\n| 1   | james | manager |\n| 2   | bond  | agent   |\n\nthen you can reference the file in your type definition as\n\n```graphql\ntype User @datasource(name: \"users\") {\n  id: ID\n  name: String\n  title: String\n}\n```\n\n## Links\n\n- [Skimah Library](https://docs.skimah.dev/#/)\n- [Faker.js](https://github.com/marak/Faker.js/)\n\n## Maintainer\n\n[Raymond Ottun](\"http://github.com/sayjava)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayjava%2Fgraphql-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayjava%2Fgraphql-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayjava%2Fgraphql-sample/lists"}