{"action":"created","issue":{"url":"https://api.github.com/repos/begriffs/postgrest/issues/310","labels_url":"https://api.github.com/repos/begriffs/postgrest/issues/310/labels{/name}","comments_url":"https://api.github.com/repos/begriffs/postgrest/issues/310/comments","events_url":"https://api.github.com/repos/begriffs/postgrest/issues/310/events","html_url":"https://github.com/begriffs/postgrest/issues/310","id":110451608,"number":310,"title":"GraphQL revisited","user":{"login":"ruslantalpa","id":5537246,"avatar_url":"https://avatars.githubusercontent.com/u/5537246?v=3","gravatar_id":"","url":"https://api.github.com/users/ruslantalpa","html_url":"https://github.com/ruslantalpa","followers_url":"https://api.github.com/users/ruslantalpa/followers","following_url":"https://api.github.com/users/ruslantalpa/following{/other_user}","gists_url":"https://api.github.com/users/ruslantalpa/gists{/gist_id}","starred_url":"https://api.github.com/users/ruslantalpa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruslantalpa/subscriptions","organizations_url":"https://api.github.com/users/ruslantalpa/orgs","repos_url":"https://api.github.com/users/ruslantalpa/repos","events_url":"https://api.github.com/users/ruslantalpa/events{/privacy}","received_events_url":"https://api.github.com/users/ruslantalpa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-08T13:31:54Z","updated_at":"2015-10-08T14:00:22Z","closed_at":null,"body":"![meme7b7b94473d7dcc19](https://cloud.githubusercontent.com/assets/5537246/10366948/39639a0c-6dd6-11e5-9cc5-bf25ab56e70b.jpg)\r\n\r\nI am quite interested in the new (frontend) technologies coming out of FB and GraphQL + Relay + React is a very powerful combination.\r\n\r\nI want to propose to steer the capabilities of postgresql to be isomorphic to a graphql server.\r\nAfter the addition of &select with it's nested capabilities, the \"read part\" has the same power as a GQL server\r\n\r\ncompare this\r\n```\r\n{\r\n  projects (active: true) {\r\n    id,\r\n    name,\r\n    client {\r\n        id,\r\n        name\r\n    },\r\n    tasks (completed: false) {\r\n        id,\r\n        name\r\n    }\r\n  }\r\n}\r\n``` \r\n\r\nto this\r\n```\r\n/projects?select=id,name,client(id,name),tasks(id,name)&active=eq.true&tasks.completed=eq.false\r\n```\r\n\r\nThe other lacking part is \"mutations\", in GQL you can say \"make this mutation then return this data\".\r\nIn postgrest you can say \"Prefer:return=representation\", we could extend it to something like \"return=id,name,client(id) ...\"\r\n\r\nWith this additional capability, i think (more or less) postgresql can act as a graphql server (has the core capabilities).\r\nNow the main question is, how to make postgresql understand a graphql query.\r\nThe first approach would be to code it in through a parser which would not be too hard to do but i hope it would be unnecessary.\r\n\r\nWhen looking at relay (frontend client that talks to a graphql server) i noticed a part of code called RelayNetworkLayer.\r\nI think it provides the capabilities to intercept a GQL query and translate it into a postgrest request.\r\n\r\nPlease look at [this video] (https://www.youtube.com/watch?v=Pxdgu2XIAAg) to get a sense of why i'm advocating graphql support. \r\n\r\nPS: Did someone get the reference of the image? :)\r\n"},"comment":{"url":"https://api.github.com/repos/begriffs/postgrest/issues/comments/146554356","html_url":"https://github.com/begriffs/postgrest/issues/310#issuecomment-146554356","issue_url":"https://api.github.com/repos/begriffs/postgrest/issues/310","id":146554356,"user":{"login":"calebmer","id":8282507,"avatar_url":"https://avatars.githubusercontent.com/u/8282507?v=3","gravatar_id":"","url":"https://api.github.com/users/calebmer","html_url":"https://github.com/calebmer","followers_url":"https://api.github.com/users/calebmer/followers","following_url":"https://api.github.com/users/calebmer/following{/other_user}","gists_url":"https://api.github.com/users/calebmer/gists{/gist_id}","starred_url":"https://api.github.com/users/calebmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calebmer/subscriptions","organizations_url":"https://api.github.com/users/calebmer/orgs","repos_url":"https://api.github.com/users/calebmer/repos","events_url":"https://api.github.com/users/calebmer/events{/privacy}","received_events_url":"https://api.github.com/users/calebmer/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T14:00:22Z","updated_at":"2015-10-08T14:00:22Z","body":"Playing the long game, nice :relaxed:\r\n\r\nI'm struggling to understand why we want GraphQL. I haven't yet watched the video (but I will when I have time) is there any way you can briefly describe the benefits (1)? Also, why support it server side and not client side (2)? And with all this talk about PostgREST layers (#306, #260) why not use a proxy to translate GraphQL into the syntax PostgREST supports (3)?\r\n\r\nI'm going to be upfront, I'm a little biased against React and friends (especially with the whole death to CSS stuff). Facebook seems to be completely moving away from the rest of the tech industry and standards committies with their software, which I am not confident will last in the long term. (Bias no. 2 I joined this project hoping to push things in the JSON-LD direction :blush:)\r\n\r\nAll that said, if we can add GraphQL support for free (read: no breaking changes, doesn't change the project's vision, bugs are isolated), why not?"}}