{"id":15350960,"url":"https://github.com/sboorlagadda/g2ql","last_synced_at":"2025-04-15T20:23:42.658Z","repository":{"id":113279506,"uuid":"128707701","full_name":"sboorlagadda/g2ql","owner":"sboorlagadda","description":"Add GraphQL to your Cache and not cache to your GraphQL.","archived":false,"fork":false,"pushed_at":"2019-10-05T04:24:33.000Z","size":178,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T01:03:08.330Z","etag":null,"topics":["geode","graphql"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sboorlagadda.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-09T03:11:17.000Z","updated_at":"2024-06-08T14:39:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"e20af22e-53f9-456e-92bc-ed95a67c8f95","html_url":"https://github.com/sboorlagadda/g2ql","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.11111111111111116","last_synced_commit":"42b53ac8dad69464776e11bc47bc4eea678ee5ee"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sboorlagadda%2Fg2ql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sboorlagadda%2Fg2ql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sboorlagadda%2Fg2ql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sboorlagadda%2Fg2ql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sboorlagadda","download_url":"https://codeload.github.com/sboorlagadda/g2ql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249146298,"owners_count":21220110,"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":["geode","graphql"],"created_at":"2024-10-01T12:00:00.211Z","updated_at":"2025-04-15T20:23:42.650Z","avatar_url":"https://github.com/sboorlagadda.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# G2QL - Geode GraphQL Extension\n\nDespite its name, GraphQL was not meant to be SQL for graph databases. Instead, GraphQL is an API query language developed by Facebook to improve the performance of interactions between a server and a client, such as a web browser or mobile app.\n\n**GraphQL = Projection + Composition** for your APIs.\n* **Projection** Client specifies what data fields it needs. Avoiding a predefined output format means that no unneeded data is sent, reducing the response transfer time to the necessary minimum.\n\n* **Composition** Client can fetch multiple resources in a single query. Avoiding multiple back-to-back server requests means significantly less latency to complete loading data on the client.\n\n## Why G2QL?\n\nG2QL is an extension that adds a new query language for your Apache Geode™ or Pivotal GemFire clusters that allows users to build web \u0026 mobile applications using any standard GraphQL libraries. G2QL provides an out-of-box experience by defining GraphQL schema through introspection. G2QL can be deployed to any Geode cluster and serves a GraphQL endpoint from an embedded jetty server, just like Geode’s REST endpoint.\n\nG2QL aims to provide an out-of-box solution,\n * For anyone looking to add GraphQL to an existing microservice architecture.\n * For anyone dealing with object graphs.\n\nGraphQL is a solution for reducing API chatter between applications and backend services. It is easy to adapt GraphQL as a layer on top of existing microservices, without realizing that the problems that GraphQL helps to solve between apps and backend now arises between the GraphQL endpoint and backend services. To overcome this, caching is then added to the GraphQL endpoint. Without caching, a GraphQL server is inefficient and fetches a single entity several times from the underlying source. With GraphQL as a query language, Geode can provide an out-of-box solution for anyone adapting GraphQL technology. \n\nG2QL is also a solution for users who have been grappling with how to deal with object graphs and relationships in Geode. With G2QL, users can use standard GraphQL libraries to query/mutate object graphs, and G2QL takes care of retrieving/storing data to respective Regions holding underlying domain models.\n\n![](assets/graphql.png)\n\nWhile adding cache to GraphQL server is a natural solution, **G2QL** takes a reverse approach by adding GraphQL to a distributed cache.\n \n### G2QL Annotations\n\nUsers can use G2QL annotations to control introspection. Assuming user has a region /Person\u003cString, Person\u003e, then annotate the field to let G2QL infer the relationships.\n\n```\nclass Person {\n    String id;\n    \n    String name;\n    \n    @GeodeGraphQLConnection(region=“Person”)\n    List\u003cString\u003e fiends; //store keys to person objects\n}\n```\n### Roadmap:\n - add cache listener to keep GraphQL schema up-to-date\n - support mutations and subscriptions\n - introspect PDX types\n - introspect oql indexes\n - extend integrated security\n\n### FAQs\n- **Why is a server side extension?** Developers can build a micro service reading data through Geode Client APIs, G2QL is more of an out-of-box experience.\n- **Why not OQL over developer REST APIs?** Using OQL, users can do projection + composition of multiple region data, but its not intuitive and there is no client libraries. GraphQL has hundreds of libraries in various languages.\n- **Why not invoking a function over REST API (to do all the work and return the JSON)?** With G2QL, non-java app developers do not have to write geode functions.\n\n## Getting Started\n\n1. Build a shadow jar using gradle target `shadowJar`\n\n    ```\n    $ ./gradlew clean shadowJar\n    \n    ```\n1. Deploy G2QL to any running Geode cacheserver\n    ```\n    gfsh\u003e deploy geode-graphql-1.0.jar\n    gfsh\u003e execute function --id=graphql-init\n    ```\n\n### Running unit tests\n```\n./gradlew test\n```\n### Running integration tests\n\n```\n# downloads and starts locator and cacheserver\n./gradlew start\n\n# to run integration tests\n./gradlew integrationTest\n```\n\n### Built With\n\n* [graphql-java](https://github.com/graphql-java/graphql-java) - Java implementation of GraphQL Spec.\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsboorlagadda%2Fg2ql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsboorlagadda%2Fg2ql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsboorlagadda%2Fg2ql/lists"}