Examples in monorepo?

Should we move examples to the monorepo?

Benefits that I can think of:

  • You can run CI against examples
  • A breaking API change PR will/must update examples too

Examples don’t have to live under packages/. They can go under examples/


Interesting idea (although I don’t think CI will work out of the box).

What’s an example of an Example that it would be helpful to include? :wink:

I mean existing examples in the GitHub organization. They can move to the monorepo.

Wouldn’t that be inconvenient if you’d want to clone the example as a starter?

I really like that the example apps are these self contained repos that anyone can reference and understand as a single entity.

I understand that the advantage might be that it’ll be simpler to work on the framework if there’s an example app inside of the monorepo?

Maybe the new rwdev command that I’ve added would help?

One benefit of examples in the monorepo is to help make sure they’re always up-to-date. From past experience, it’s quite annoying to learn from an example project that’s not working or not relevant anymore

I’m not sure that having them in a monorepo would guarantee that they would be up to date, the only thing that would be updated automatically would be the @redwoodjs/* packages, and I think the same reasons (lack of time, apathy, etc) for not updating an example project would happen regardless of where they’re stored.

I’d add the examples as part of the test-suite in the monorepo to make sure they’re always up-to-date. IMHO It’s part of a great DX

Hi @phzbox we definitely want to add+improve CI and automation for the Example Apps and between the monorepo and Examples. But this won’t necessarily require a mono-repo.

Also, with the current structure we see experience advantages for people using the projects, i.e cloning/forking/updating/Issues/etc.

To be clear, conceptually this is an interesting idea. And we have definitely talked about it as you and others have brought it up. So thanks for putting it out there. And we welcome more discussion as it comes.

1 Like

I don’t think examples should be considered starter pack for devs. Other projects like next.js have examples residing by the code and get the benefit of CI checks on every PR.

I imagine as Redwood grows, the number of official examples will grow with it too. It would be easy to add a new feature and fix a bug without checking it against all examples.

This is why I’m working on bringing in the default template into the monorepo as well. I am imagining end-to-end tests that uses the template to start and moves the development forward by running CLI generate commands and makes sure things are working correctly. That sort of test can also test against examples.

Monorepos may feel counter intuitive but they solve a lot of problems. Git and GitHub infrastructure has no problem with lots of code in a single repo.