Well, it's not the only cure. Apparently there are at least 9 causes of depression. And community is probably the one that takes the most effort to maintain.
But communities are simple to understand. Of course, it can go the other direction and become tribalism, which is also destructive. Like anything worth doing, there's a balance of what's healthy.
There's more to it than just joining a community. Apparently there's things thing called "going outside" that is also pretty effective. Not sure about that one.

Having a positive attitude is almost tautologically good for your mental health, and extreme stress can hurt your immune system, but that doesn't mean you should feel like [crap] for feeling like [crap].
Here's 20 minutes on the topic of communities to fight depression:
As intuitive as Johann Hari's talk is and although this process of "social prescription" does seem like an effective solution, we should remember that it's not a panacea either. There are plenty of people who thrive in isolation too.
