The biggest thing I can recommend (if it is safe for you to do so): share your struggles or at least some of it with your boss. I was recently diagnosed with C-PTSD among other things, but because I've been open w/my boss he's incredibly understanding when I have a need for a mental health day.
The other thing I recommend is focusing on small victories at first. Took a shower? Great! Sat at your computer? Even better! Wrote that first line of code? Doing amazing!
Remember to be kind to yourself -- mental illness is a real, valid thing and you deserve no less kindness than someone who has a broken arm, etc.
Therapy has also helped + antidepressants have gotten me to a better place where I can start to be more productive again (though I recognize this is a privilege). If you have the means I highly recommend talking to someone.
You'll get through this, and you're doing great already. Be well.
Thanks for sharing.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.