I agree. I had depression and was self harming and on Prozac from aged 16-26 following a nervous breakdown because of my childhood.
I started intensive counselling in my mid-20s and it completely changed me and I've not touched anti-depressants since (I'm 42 now).
BUT... When life has been testing since (divorce, losing loved ones, being made redundant) and situations are threatening to let depression back, I started volunteering for the homeless and my local food bank.
This is not a completely altruistic act, as it also helps me. I feel less hate towards myself as I feel I'm making a difference, I feel good that my (and other's) volunteering means people get the help they need. Plus it makes me count my blessings 100%.
Every time I felt sorry for myself I reminded myself how lucky I was / am and it really snaps me back to not letting the depression back.
I appreciate this sounds incredibly simplistic and I'm not virtue signalling here, but it genuinely changed my outlook and how I tackle the tough times. It works for me.
I also think not being materialistic helps. I like nice things when I can afford them, I don't have them if I can't, or get second hand / a compromise. I say this as I've friends that are utterly miserable about what they don't have, yet never stop to be grateful for what they DO have. Makes me so sad for them.