Maintaining same code between multiple projects

I’ve finally launched my 1st proj in beta and now beginngin work on the 2nd project. I’d like to reuse code from several modules (signup, login, …) from the 1st proj in the 2nd one.
Also, I would like to be able to update code in one module in one project - and have code in the same module of the other project be updated as well.
What would be the optimal strategy to use here?

splitting reusable modules/components up and publishing them in different repositories that you then can publish to npm and install.

i’ve used git subtrees in the past to keep common schema/collection/route code up-to-date with multiple codebases.

your best bet for nice, clean dependency management is splitting the app and publishing several npm modules. however, for small/solo teams with private repositories, subtrees have done the trick and are less of an overhaul than rearchitechting the app into packages.

1 Like

This should be useful: