Is it possible,yes. Is it easy, no. Keep in mind, the way the SSA looks at disability is not whether or not you can do that particular job with that particular employer, but whether or not you could do something similar for someone else.
That being said, I do have depression and anxiety and I did get SSDI the first time I applied. BUT, I had been hospitalized 5 times in 4 years and had to take a 3 month leave of absence from my last job. I was taking 4 psychoactive medications. I was on final notice to be terminated because of errors I made due to poor concentration, but I ended up being laid off with a bunch of other people.
That was in 2010 when unemployment was almost 10%. Being over 50 didn't help my prospects of getting a new job. My depression, which was already bad, got worse, and my family DEMANDED that I apply for disability. I met a guy when I was in the hospital the last time who had gotten SSDI and he strongly recommended his attorney. I went with the attorney, who specialized in mental health disability claims. Well, I got it on the first try, but I didn't get any back pay.
Here's the thing. When I got the SSDI, I hadn't been unemployed for 18 months. Now I've been unemployed for 3 years. The longer you are unemployed, the harder it is to find a new job. I am living on less than half of my former take home pay, but I don't qualify for food stamps or Medicaid. A friend of mine gets less than I do, only $811, and she gets $16 in food stamps. Thankfully I live in a county that has a health program for the poor that I do qualify for, because my medications alone would cost me over $1000 a month.
If you do decide to apply for disability, I recommend that you speak with an attorney first. It won't cost you anything. The only pay they get is 30% of your back pay and that's only if you get back pay. This is controlled by law. They can get no part of your monthly payment. See if there are any DBSA support groups in your area. That's the Depression and Bipolar Support Alliance. They are good meetings to go to, and you may find people there who are getting SSDI.
Now that you've been terminated, you can apply for unemployment benefits and start looking for another job. I recommend that you take advantage of any and all services your local unemployment office offers.