Is there a way to stop depression before it starts?

Prevention is key. There are many ways one can prevent the onset of depression: maintaining social relationships and activities, exercise and physical activity, healthy diet, good sleep, mentally stimulating activities, practicing mindfulness, avoiding addictive drugs or excessive alcohol, etc.
Wouldn't it be great. Redefine depression or any other uneasiness as an indicator of wonderful things you are desiring, and focus on the joy you would feel when all those wonderful things manifest for you, and let that joy inspire you to faithfully and joyfully hang in there and/or do what you need to do to make the things you desire manifest...