{"id":20519411,"url":"https://github.com/gramps-graphql/data-source-base","last_synced_at":"2025-04-14T02:10:38.035Z","repository":{"id":48979898,"uuid":"107060331","full_name":"gramps-graphql/data-source-base","owner":"gramps-graphql","description":"Boilerplate for creating a GrAMPS-compatible data source.","archived":false,"fork":false,"pushed_at":"2020-06-02T11:43:21.000Z","size":3184,"stargazers_count":52,"open_issues_count":25,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T16:09:07.514Z","etag":null,"topics":["apollo-server-express","apollographql","boilerplate","gramps","gramps-data-source","graphql","graphql-server"],"latest_commit_sha":null,"homepage":"https://gramps.js.org/data-source/data-source-overview/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gramps-graphql.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-16T00:34:40.000Z","updated_at":"2023-02-10T15:46:22.000Z","dependencies_parsed_at":"2022-08-30T08:01:17.322Z","dependency_job_id":null,"html_url":"https://github.com/gramps-graphql/data-source-base","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramps-graphql%2Fdata-source-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramps-graphql%2Fdata-source-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramps-graphql%2Fdata-source-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gramps-graphql%2Fdata-source-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gramps-graphql","download_url":"https://codeload.github.com/gramps-graphql/data-source-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429126,"owners_count":21101786,"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":["apollo-server-express","apollographql","boilerplate","gramps","gramps-data-source","graphql","graphql-server"],"created_at":"2024-11-15T22:13:23.869Z","updated_at":"2025-04-14T02:10:38.000Z","avatar_url":"https://github.com/gramps-graphql.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://gramps.js.org/\"\u003e\u003cimg src=\"https://gramps.js.org/assets/img/gramps-banner.png\" alt=\"GrAMPS · An easier way to manage the data sources powering your GraphQL server\" width=\"450\"\u003e\u003c/a\u003e\n\n# GrAMPS GraphQL Data Source Base\n\n[![Build Status](https://travis-ci.org/gramps-graphql/data-source-base.svg?branch=master)](https://travis-ci.org/gramps-graphql/data-source-base) [![Maintainability](https://api.codeclimate.com/v1/badges/1858e5dd8acfad0d4540/maintainability)](https://codeclimate.com/github/gramps-graphql/data-source-base/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/1858e5dd8acfad0d4540/test_coverage)](https://codeclimate.com/github/gramps-graphql/data-source-base/test_coverage) [![npm version](https://img.shields.io/npm/v/@gramps/data-source-base.svg?style=flat)](https://www.npmjs.com/package/@gramps/data-source-base) [![Greenkeeper badge](https://badges.greenkeeper.io/gramps-graphql/data-source-base.svg)](https://greenkeeper.io/)\n\nA boilerplate and minimal example for a [GrAMPS data source](https://gramps.js.org/data-source/data-source-overview/).\n\n## Quickstart\n\nSet up a local data source in seconds with:\n\n```bash\n# 💥 zero dependencies! no global installs! create a new data source\nnpx graphql-cli create -b gramps-graphql/data-source-base data-source-mydata\n\n# 📂 move into the newly-created data source\ncd $_\n\n# 🚀 start the GraphQL Playground with your spankin’ new data source\nyarn dev\n```\n\n\u003e **NOTE:** We recommend prefixing data source projects with `data-source-` for clarity and the eventual support of CLI tools to add data sources to your gateway. So if you’re creating a user management data source for the Acme company, we recommend `data-source-acme-users` or `data-source-acmeusers` as a directory/repo name.\n\n\u003e **ALSO NOTE:** `$_` is a handy shortcut for using the last argument passed to the previous command. It [also does other stuff](https://unix.stackexchange.com/questions/280453/understand-the-meaning-of), but that's a rabbit hole for another time.\n\nAfter running `yarn dev`, you’ll see a message with URLs for the GraphQL gateway and the [GraphQL Playground](https://github.com/graphcool/graphql-playground). Open the Playground link (usually http://localhost:8080/playground if you don’t already have something running on port 8080), then run a query:\n\n```graphql\n{\n    getById(id: 123) {\n        id\n        name\n        lucky_numbers\n    }\n}\n```\n\n### To Develop with Mock Data\n\nAdd the `--mock` flag to enable mock data, which is helpful for working offline.\n\n```sh\n# Start the gateway with mock data\nyarn dev --mock\n```\n\nSee `src/mocks.js` to modify your mock resolvers.\n\n\u003e **NOTE:** For more information on the GrAMPS CLI and its available options, [check out the docs](https://gramps.js.org/cli/cli-overview/).\n\n### To Run the Tests\n\nGrAMPS data sources start you off with 100% test coverage so you can build high-reliability GraphQL servers without a bunch of setup work.\n\nRun the tests with:\n\n```bash\nyarn test\n```\n\n## What's Inside?\n\nInside, you’ll find:\n\n* **Schema** — type definitions for GraphQL to interpret the data (see the\n  [GraphQL docs on schemas](http://graphql.org/learn/schema/))\n* **Resolvers** — functions to map the results of calls to model methods to\n  the schema\n* **Mock Resolvers** — mock functions for offline development\n* **Context** — an object with methods to interact with data that is passed to resolver functions\n\nEach file contains a `TODO` comment explaining the changes you’ll need to make to create a working data source.\n\nThe goal of this repo is to provide enough code to allow a working example of a data source and its related tests, but to limit how much boilerplate needs to be edited to get your own data source implemented.\n\n## Code Quality and Continuous Integration\n\nTo help ensure a reliable, easy-to-maintain data source, this example also includes:\n\n* Configuration for Travis CI (for automated testing) and Code Climate\n  (for quality analysis)\n* Starts you off right with test coverage at 💯\n* Provides testing helpers for common resolver testing patterns\n* Comes with docs! https://gramps.js.org/data-source/data-source-overview/\n\n### Notes for Developers\n\nCurrently, there is no watch capability (PRs welcome!), so the service needs to be stopped (`control` + `C`) and restarted (`yarn dev`) to reflect new changes to the data source.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgramps-graphql%2Fdata-source-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgramps-graphql%2Fdata-source-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgramps-graphql%2Fdata-source-base/lists"}