There are no strict rules when it comes to music production. You just have to be creative as much as you possibly can and of course with the end result of producing music that is ear-catching to the listener.
You can start with either chord progressions and write a melody on top of that or you can first write a melody and then harmonize that same melody with chords. The choice is all yours.
But remember writing chord progressions first and then attempting to write a melody might make the melody a bit boring to some music producers since they will have this urge to follow the chord notes rather than using other notes that are part of the scale.
Nothing is set in stone so do what works best for you.