The biggest factors to me: use appropriate, future proof (insofar as possible) reliable tools and frameworks. Favour popular established libraries over custom code. This can dramatically reduce surface area you need to maintain, and simplify the code that remains.
Simple but often neglected.