I'm wondering if when composing one would start with an idea for harmony such as a chord progression, or does one start on the melody side maybe developing a melodic motif. What comes first, or maybe there are no rules?
From having heard/read hundreds of accounts of 'how I wrote this hit song' over the years, it's fairly clear that in the world of popular song, approaches that might be characterised as 'Harmony First' and 'Melody First' are both frequently used. One extremely common story is for the a concept or a lyrical idea to give rise to a little fragment of sung melody, which then evolves into a song. Another common type of story is for a player to be experimenting with an instrument and come up with an interesting sounding riff or progression over which lyrical ideas are generated - e.g. This account of R.E.M.'s Losin my Religion.
I think it's relatively rare in pop music to come up with a complete melody and only then to harmonise it. What may be more common is to almost simultaneously come up with a melodic fragment and accompanying riff or chords, and expand that structure into a whole song. Journey's Don't Stop Believin' is an example of this, as recounted here.
It's always interesting to read more accounts to get a feel of how different creative processes can work:
Sound on Sound "Classic Tracks" (newer articles require subscription, but most can be read in full)
One of the things that makes it possible for pop musicians to quickly flesh out an idea in different directions is that they will quite often be working in a well-understood form, where there are strong expectations about how a song will evolve, what kinds of chords will be used, how the lyrics will relate to the song structure, the function of the song (e.g. whether it has a dance rhythm, and if so, which one) and so on. These specifics can be very different in different styles (grunge will have very different norms to modern r'n'b), but within a style they often form strong guidelines. I think it's probably true across genres that what really comes first (or at least, early on in the process) is a set of assumptions that come from the style that the artist is working in and the function a song will have.
I worked at a newspaper press room where the rhythm of the press inspired me to write songs. I've written songs where I started with the lyric and I've written songs where I started with the chord progression. I can't remember starting with the melody, but each time, each song seemed to come from out of the ethers to me, kind of like an inspiration, so perhaps I'll have the experience of starting with a melody in the future. When I have tried to sit and write a song using any method, that's when I have had disastrous results, it only seems to work for me when I let go of the process.
Chicken or egg? It's anything and everything. If it's a few words, they often have their own rhythm, so the next part of the chain is automatic. If it's a melody line, that may well spawn some words. With the same melody comes the opportunity to narrow down the underlying harmonies. It could be a set of chords, which again will help dictate what notes fit to produce a tune.
Inspiration is odd. One could wake up with the whole caboodle as a finished article, ready to listen to.
There certainly isn't a magic formula. although an individual may work best with notes first, or words first. Or work with another person who is better at what they're not. Many, many couples have written many, many good songs. The Gershwins, Rodgers and Hammerstein, Lennon and McCartney, Elton and Bernie come to mind.
What on Earth gave you the idea there may be rules?
So you want to compose? (I assume your question really is -- what should I start with) ?
The answer is both. But not at the same time.
If you want to learn to compose music, you need to train. One very good suggestion I tend to give is to train a lot. I recommend a regime where you complete one song a day for a month ( It is Ok to take Sundays off ) . None of the songs will be good, none will survive -- a full wastebasket is a sign that you are learning.
So make a plan: start every other time with the harmony, every other day with the melody. After a month you will know which works best. For you.
Anyway, my two cents.
The answer is "Yes". Both approaches and others may be used to compose music. Creating music comes from Inspiration. So, if a melody comes and inspires you, follow it, develop it and see where it leads. Same goes for a single chord or chord progression or a rhythm, sound effect or any sound that inspires you. Once you've got that then you can apply your theories. Enjoy!