Thanks for the kind words Sal!
There’s really nothing stopping you from using Gatsby in the way you’re suggesting and now you’ve got me curious what will happen. You’ll just have to give some thought to what data is static and what’s dynamic. There’s some great documentation on how to use non-GraphQL data in the createPages
function for the static part.
As for the dynamic part, if you think about it, using Auth0 is essentially the same concept – you’re fetching outside data from an API dynamically inside of a service. So, again, nothing stopping you from doing the same with outside APIs. Keep in mind, though, that there are some tricky things we have to do to get that working, like how we use wrapRootElement
and add a workaround to the Webpack build (see here in the article). This is due to the static nature of Gatsby and how it only mounts the root element once. So if you encounter anything weird like that you may need to experiment.
So, to answer your questions:
- The point of the Auth0 implementation in the scenario Jason and I describe is mostly for the sake of a persisted user profile and limiting access to things. For example, the Gatsby swag store (repo) uses Auth0 to get GitHub data and associate you with the Shopify purchase (another external API!). If you end up protecting an API, you’ll also need to use Auth0 to handle that access token.
- I think ^^ answers this.
- I don’t think in your case it matters much if I understand how Next works, because in either case you want your React app to be handle the data on the client side.
Let me know how this goes. I’m curious if you run into anything weird trying to load external data dynamically. Nothing jumps out at me but I could be missing something with the way Gatsby renders things. The Store repo seems like a good guide for what you’re doing.
Cheers,
Sam