The best way to visit the beautiful areas of Amalfi and Sorrento and Capri and Portafino is using Naples as your base.
You can use the Circumvesuviana train system from the Central station which stops in Pompeii and Sorrento from Naples and it only costs 2-3 USD each way.The only problem is they have no AC so be prepared by bringing water with you.
From Sorrento you can catch a group of Buses that will take you to a variety of cities.They are new and have AC that really works.These Buses are cheap about 3 USD but they can be crowded.I took a Bus to Amalfi and Portafino.
You can also go to Capri with a Ferry and either come back to Naples or go on to another city like Portafino.
You can find prices online for the different options available. I would rather not give a specific Company since it would appear I was getting paid for the recommendation.
The Hotels in any of the cities along the coast tend to be much higher then Naples so if you want to keep your costs low having Naples as your base will help your money go a much longer way.