Hi @freddydumont! Thanks for starting this conversation. I do want to clarify one thing to make sure I’m on the same page — there’s a difference between integrating Redwood and Gatsby Vs. using Gatsby for your “www” and Redwood for your “app”.
Gatsby “www” + Redwood “app”
The simplest way to do this is have 2 separate projects (repos). In your deployment configuration (e.g. Netlify dashboard), you’d set the Gatsby project to deploy to something like https://mysite.com
and the Redwood project to deploy to https://app.mysite.com
.
And if you wanted to, you could use Lerna (on top of Yarn Workspaces) to create a Monorepo. It would require some config and setup, of course. And I might even recommend your directly structure in this case to be:
- www (gatsby)
- gatsby folders
- gatbsy root files
- app (redwood)
- api/
- web/
- redwood root files
package.json
other monorepo/lerna config
Both Netlify and Vercel allow you to deploy multiple sites from a Monorepo.
Gatsby + Redwood integration
If you’d like to swap the Redwood Web side for Gatsby (e.g. replace the web/
files in a Redwood Project with a Gatsby project), it’s conceivably possible although you’d be the first I know of to try it. I’m very curious how it might work. Or even if it would work.
Since the Redwood API is GraphQL, you should be able to consume it with Gatsby although I’m not familiar with how Gatsby works at this level. (Note: you wouldn’t have to integrate the two for Gatsby to use a Redwood API — you could do this in the first example above as well.)
You’d need to manually handle the CLI for local dev and build with custom package.json scripts, which I don’t think would be too bad.
But you’d most likely lose Redwood generators and Cells – you could try to use the required imports for Cells but I think it would take extra config to make it work with Gatsby’s data fetching (if it even worked at all).
So I’m not sure what you’d gain in doing this other than having fully pre-rendered pages/routes across both your “www” and “app”. You’d have access to the Gatsby plugin ecosystem throughout as well. But, again, this assumes integration like this is even feasible.
Anyone else have any ideas about how, or even why, and integration could and should work?