I really dislike paying for dirt or for compost, but it happens. The reason I don't want to buy the dirt is that I can make my own in the backyard! Composting doesn't take a lot of space, but it does take some attention. If you plan to be a gardener or already are, then compost is most likely a part of the garden plan. Adding compost, creates a nutrient rich soil.
There are different kinds of compost. Manure can be composted. You might find bags of mushroom compost, cow manure compost, horse manure compost, and some cities offer compost (made from the yard waste and other brush and leaf collections). In Madison, the city is experimenting with a food waste compost program. All offer different nutrient levels, but I am not getting into that science lesson.
I like composting not just to save buying soil, but to have a place to put my food waste. It is really unnecessary to fill our landfills with food waste (where nothing good can come of it), if it can so easily be turned into something useful. My garbage doesn't stink or get messy. I am putting less plastic to waste in not filling the garbage so often and in not buying huge plastic bags of soil and compost!
You can check with the city to see if yours has compost bins for sale as Madison does. They also might sell small buckets that you can collect the food waste in and then empty outside in your bin. Do this often or you'll end up with fruit flies. Many other sources for buying and methods for building your own bin are out there as well. There are many opinions and ideas on what works best. I honestly don't know who is right on that question. What works best is the one you tend most often.
Choose a spot for composting that is somewhat sheltered and somewhat sunny. Make layers to get things going. Layer in garden clippings, leaves, kitchen waste, and even things like wood ash. Keep things moist. If it dries up, then the microbes won't survive that start the process and soon all the good bugs and worms needed to break things down will be gone.
Keeping things moist is the tending. But, you need to stir it up as well. This is where I often fall short. I don't stir things up and get the layers working together. I now have 2 piles, so I can just shovel out of one and into the other, water, and let it do it's work!
What can be put in the compost heap? Any vegetable and food waste from the kitchen. Chop it up for best results. Grass clippings from the yard as well. Leaves work best if you can chop them up. They will take longer if put in whole. I am currently having fun with a list I found that had many items I was not aware were compostable. Paper towels, tissue, dryer lint, dust bunnies, cat hair (go to squido for more). It's good to keep in mind that there should be a 3:1 ratio of brown (carbon) ingredients to green (nitrogen). Brown is often the kind of stuff that I think of as related to trees and wood (leaves, paper products) and green is vegetable and fruit scraps, in general. Have fun experimenting with what all can go in there!
Don't put meat or feces or even some weeds in there. It's often too difficult to fully compost and the meat and feces attract unwanted guests, plus can lead to disease. My neighbors had a ton of tomatoes in their compost one year and because the pile did not get hot enough to decompose the tomato seeds, the garden was full of tiny, unwanted tomato plants. I avoid putting tomato plants from the garden or leaves in there as well, because there might be a fungus lingering on the leaves or stems.
Even if you never get around to really using your compost in your garden, you will be eliminating waste and it's a fun science experiment!