You are not a failure. You are being dealt a bad hand, and that has happened to entire generations before you.
When external structure disappears, you must replace it with internal structure. Keep a fixed daily routine. Get up at the same time every day and go to bed at the same time every night, regardless of mood or circumstances. Plan for eight hours of sleep. Treat this as non-negotiable.
Take care of your body. Exercise regularly, even if it feels pointless at first. Eat properly. These are not self-help platitudes; they are basic maintenance requirements for keeping your mind functional under prolonged stress.
Be very strict with digital consumption. Doomscrolling and sulking are forms of digital procrastination and they actively worsen the situation. Before switching on the TV, unlocking your smartphone, or engaging with any social media, do 20 push-ups. Every time. If you cannot do push-ups, replace them with squats or another short physical exercise. The goal is to insert friction and break the automatic habit loop.
Do not lie to your friends about your situation. That usually makes things worse over time, not better. People talk, and they already know more than you think anyway.
If you cannot find a job in tech right now, apply to other jobs you can realistically get. Any job. Then become very good at it. Be dependable, knowledgeable, and reliable.
At the same time, actively look for better opportunities. Treat this as an ongoing process, not something that passively happens to you. Apply, network, learn, and reposition yourself continuously. Your loyalty is first to yourself, second to your family, and then to the people you care about, never to an employer. When you find a better opportunity, take it. Change jobs if needed. Repeat.
This is not a judgment on your abilities. It is a rational response to current conditions.