I must add to this: choose a right technology stack!
Sticking to most popular choices in your technology stack increases your project chances to find more people familiar with this stack.
It helps recruit new people, makes easier to onboard new members and overall maximizes bus factor.
So for any kind of project, built from scratch or legacy: select well-known technologies, or switch to them.