How to learn/accept/move on/remain happy when bad things happen in life?

My 6 year relationship ended at the beginning of May and I have a lot of changes going on. I'm a lone for the first time in a long time, I'm getting my own apartment and will be living alone. This is all very new to me I know there is a lesson in this but idk what it is yet. I'm trying to see the good but I'm still so hurt and want to be with him 😢