rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

GraphQL API server RFC

Open jgierer12 opened this issue 6 years ago • 4 comments

RFC for gatsbyjs/gatsby#10230.

View text

jgierer12 avatar Dec 05 '18 04:12 jgierer12

Great stuff! While Gatsby can be used for the web, it currently doesn’t offer a solution for native apps AFAIK (or does it?). If Gatsby’s data layer could be run as a backend it could help a lot. Not quite clear how authentication would be handled though.

Our app is available through web, iOS and Android so I’d be really excited to see this happening. We have a PostgreSQL database, so Gatsby could sit in front of it with gatsby-source-pg (or using Prisma, Hasura etc), alongside other sources stitched together by Gatsby, and the whole thing would be available to web, iOS and Android clients.

sedubois avatar Dec 05 '18 09:12 sedubois

Interesting, I haven't considered that use case yet, but it's certainly a huge one. I mainly focused on using the data in projects that are already static Gatsby apps.

I also haven't thought much about authentication yet, IMHO we should not implement any auth in the core api-server and let users configure it themselves via the JavaScript API if they need it. I believe a setup where the API is publicly accessible is enough for most use cases.

jgierer12 avatar Dec 05 '18 18:12 jgierer12

Added new drawback:

Queries that are the same at build time and run time must be duplicated (example).

jgierer12 avatar Feb 19 '19 11:02 jgierer12

@jgierer12 That seems solvable — if we see the query being used elsewhere, we could preserve it instead of removing it during the build. There might be some restrictions I'm not aware of, but I think we could definitely fix this without requiring duplicated queries.

jlengstorf avatar Feb 28 '19 16:02 jlengstorf