There's another element of depression that I realized much later on, and has subsequently borne out in scientific research: namely, the importance of feeling in control. People who feel very in control of their lives have markedly lower rates and risks of depression that people who don't feel much in control of their lives. Which makes sense; when I felt depressed, the best way to describe that feeling, really, was feeling helpless. Feeling like I had no idea what to do to change my life, and no resources at my disposal to start changing even if I did know what to do.
So, for that reason, I recommend always keeping many options in your back pocket. Options for your job, options for dating, options for where you'll live in the world. Have options. Doesn't mean you need to exercise them; just knowing you have them is enough to make depression irrelevant.
A great article by Chase Amante about how to conquer depression: