If you look at these two* YouTube clips, you will see how Chet Atkins played fingerstyle guitar. Although these two performances were about forty years apart, the principles are the same. He plays melody and chords either at the same time, or he establishes the melody and then noodles around with the chord. Sometimes he lays down the chord and then plays the melody. If you want to play fingerstyle, you should first be sure that you can play each chord in at least four different places. We're talking inversions here. Before you add your melody, make sure you have a good accompaniment. The melody notes will either be in the chord or nearby. Don't play any notes that are higher than the melody unless they are understated. If you play notes in the chord that are higher than the melody, the melody will get lost. If you understand these principles, you can make lots of splendid guitar solos without much fuss.
* Second clip no longer available.