Welcome to the wonderful world of composting!
Single best thing you can do for your garden!
Yes you do need some kind of containment for your compost pile, to keep it piled and to keep critters out. That can be simple and home made or elaborate and expensive. Here's steps to making a simple wire compost bin (but for the critters, you would also want to make a lid to put over it)
I have one about like this, but mine came with a top panel:
They can also be made from wooden pallets, concrete blocks with open centers or whatever you have on hand.
This has plans for several different kinds of homemade bins:
The indoor alternative is worm composting aka vermicomposting. Type vermicomposting into the Search the Forum feature and you will find a lot of info about it. A worm bin is small and tidy for indoors and will turn your kitchen scraps into lovely worm castings. Will not have fruit flies or smell. But it is mainly for digesting your kitchen scraps, IMO (not doing worm composting myself) it would not be what you would do to deal with yard waste.
I live in the city, but we have possums, very bold raccoons, squirrels, groundhogs and a variety of small rodents. My wire bin with the lid works quite well for keeping all the larger critters out of the pile. I know small ones do get in there, because I find stuff dug up that was buried in the pile, but we all manage to coexist. It also does not have fruit or any other flies or smell. When I dump the bucket of kitchen scraps on the pile, I cover it with a good layer of weeds/ leaves, etc. No smell!
What you need for a good working pile is enough material piled up (preferably like a 3' cube of stuff), air circulation, ways for water to get in and out, so it stays just damp. You can add some wood ash, but it is pretty alkaline, you wouldn't want to overdo it. We suggest no more than 10% of your pile be any one ingredient.
Hope this is a help for getting started!