I've maintained a friendship with every ex I have but one. In that case, it's her choice.
My experience is that it's important to first find acceptance within yourself that loving someone does not mean that you are going to be more than friends-you can love someone and be "just friends" (to begin with or again).
The next thing is to take time to rebuild your life so that the time you normally spent together in a "couples" capacity is "rescheduled" into something else.
Then slowly re-incorporate them back into your life starting with reasonably large social settings first. Then working down to smaller social settings.