rfcs
rfcs copied to clipboard
GraphQL API server RFC
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.
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.
Added new drawback:
Queries that are the same at build time and run time must be duplicated (example).
@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.