I've been where you are more than once, for more than one reason. I've survived those trials, so far. I'm 61 years old now, so it's doable.
You've survived, so far, too. We have that in common. We might have been dead by now, but we're not. Every new day is a bonus life for us, now. We just have to decide what to do with it.
We'll probably make some wrong choices, and our screwups will be painful. Every mistake can be made better with some effort, though. We can learn from it. We can address the damage it does.
Every mistake except one: ending your life is final. It's the one mistake you can't fix up afterward. So be very sure you've looked thoroughly at all the other options before picking that one.
Your issues are not superfluous. They are essential and unavoidable. Every human being has the problem of figuring out how to live a good and worthwhile life. None of us is guaranteed to get it right. There are a lot of ways to get it wrong, and there are a lot of things outside our control that work against us.
But there's good news. We also have some things going for us. We're intelligent. We can learn. There are learnable skills that are applicable to these problems. There are worthwhile things that are actually under our control.
We aren't born knowing how to be happy. We're born knowing how to recognize pleasure, but happiness and pleasure are not the same thing. Pleasure is an ephemeral experience that comes and goes. We can chase it, but it remains ephemeral, and chasing it turns out not to be wise or rewarding in the long run.
Happiness is different. It's something that you can learn how to build and refine. It's hard work, but you can get better at it with practice.
Some other commenters have suggested seeing a therapist. That's a good idea. Find a good one. Good therapists are teachers. They teach you about what tools and skills exist to help you build a happy and worthwhile life, and help you get started learning how to use them.
Therapists are not mechanics. They can't fix you. They can tell you about the tools, teach you the basics of using them, and sometimes offer some training wheels to get you started, but in the end you have to do the work yourself.
We get better at what we practice. That goes for mental as well as physical skills. You already know this: you learned programming and mathematics.
You get better at what you do over and over--so pay attention to what you do. Pay attention to what helps you and what hurts you. Learn to distinguish them. Focus your attention on what helps you.
Training our attention is tricky. Any thought or feeling we give attention to gets stronger. So supressing bad thoughts is not a winning strategy. Suppression is just another kind of attention. It makes the suppressed thoughts stronger.
It's more effective to find constructive thoughts and feelings and direct your attention toward them. You'll have to do it over and over, because our attention is fickle. It jumps here and there and it likes to revisit anything it's visited a lot lately, and it's attracted to every shiny new thing. But we get better at what we repeat, so put your attention on constructive things, and then, when it wanders, put it back on constructive things again, over and over. Be patient. You'll get better at it with practice.
Learn to recognize what you truly find valuable and seek that. Learn to recognize what's under your control and what isn't. Put your attention and effort into valuable things that are under your control, and practice leaving the rest alone.
For example, you can't control whether this person or that person finds you attractive; they do or they don't.
When you use Tinder, you're hoping that someone will find you appealing and that something pleasant will come of it. That's a low-percentage strategy. You're looking for value in things outside your control, and the value you're looking for is fleeting: pleasure. You're better off looking for happiness instead of pleasure, and better off looking for it in things that you can deliberately cultivate than in things outside your control.
So what's something you can control? You can control whether you are working to advance some goal that you find valuable. So focus on that. What about that connection to another person? Other people care about things that they find valuable. Some of them will value some of the things that you do.
Some of them will offer to help you in your goals, because they share them. Accept their help with gratitude. Help them when you find their goals worthy. You'll make friends. Some of them will find you attractive, in part because of your shared values. Some will turn into something more than friends. Some will become ties that you cultivate and that reward you for years to come.
You won't control exactly which people that will be or when it will happen, but if you focus on what you truly value and what's up to you, and if you make yourself available to social ties that arise from what you truly value, it'll happen. We're social animals. We work as a species because we're inclined to help one another with shared goals.
When it does happen, the ties you form will be based on things you truly value. That will be better and longer lasting than any ephemeral moment of pleasure that random chance grants you.
I've lived through moments like the one you're describing. If I survived it, you can too. The best things in my life have come after my nights in the abyss. I wouldn't be surprised if the same thing happens to you.