Replies: 2 comments 4 replies
-
Here is what I've come up with:
My issue was that I wasn't sure how to make pages components reusable, but the (simple, in hindsight) proposed solution is to just extract all of the component into yet another component, and then have the pages only render that. That way, any changes to the ItemDetail pages for all sites can be made by modifying the ItemDetailPage function, or it's corresponding itemDetailGetInitialProps function. Presumably, server.js can be handled in a similar way. ... I think. I'm afraid that I may be missing something, and I'm afraid of going far down this route before realizing some grave mistake or problem with this way of thinking. What do you guys think? Is there a better way to do this? |
Beta Was this translation helpful? Give feedback.
-
@djuszko Take a look at https://github.com/UnlyEd/next-right-now What you want to to, we've named it "Multi Single Tenancy" and I wrote about it at vercel/vercel#3547 (comment) It doesn't support code differences between tenants (at this time), meaning all tenants share the exact same source source code, but it supports fetching/using/displaying different data using the same code base. So, all the differences between tenants lies in the data themselves. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building multiple apps which will be 80%+ the same, but am struggling to find a good way to structure these projects.
I'll use the example of books/movies/songs. I have built buybooks.com, and now want to begin working on buymovies.com and in the future buysongs.com. The structure of the sites is the same, as is their general purpose. They will have different styling/themes/images, and much of the data may be different (ie movies/books do not belong to an album but songs do), and so some customization is required. However, the majority of it will be the same.
What is the best way to structure these projects so that a change to a common component affects all projects?
My current idea is to create a monorepo with a structure like this:
I moved my components directory out of buybooks and into common so that future projects can re-use those same components, and I could make them more generic when needed in the future.
Some issues with this setup:
Another potential option would be using a git subtree or submodule. Is there any merit to these approaches?
Beta Was this translation helpful? Give feedback.
All reactions