It's fine to have a great big cry about it for a few days.
Now is the time to deploy the logical half of your brain and use it to over-rule the emotional half.
With the logical half:
Reminding you what a great person you are.
Thinking that nobody's perfect and you don't have to be, to be a great catch.
Food and drink are important at this time. Don't let yourself get physically run down. No alcohol or the barest minimum. The cliche of drowning your sorrows is a dumb one. Be clever and treat yourself to all those lovely delicious mood enhancing foods, such as cherries and tomatoes (home made tomato soup, yum yum and great on a winter's day).
You have your freedom! Freedom is priceless. Enjoy it and make the most of it.
For your next relationship:
Be selective. You have some experience on what to look out for. Avoid abusive types like the plague.
Relationships like the one you've just had are really bad for chipping away at your self esteem. And at how confidently you present yourself at social settings. Put some focus into building yourself up again.
Talk to friends and family. Be brutally honest to them as to how bad he was. The people that love you should be great support for you now. If any of them victim blame you, tell them to **** off!
Be professional when you see him. Cold and businesslike.
On no account let him sweet talk you or beg you into getting back together with him.
If he tries to assert the frame that you're trash, completely reject that frame and assert the frame that you're fine and that he's an idiot with a lot to learn.