I want to have a compost bin but my wife is (quite validly) concerned that it will be a bug factory. We already have a lot of gnats that drive her crazy.
You can't avoid bugs in compost. They're an important part of the process but there are a few things you can do.
If you do passive, cold composting, where you just throw in material and let things decay on their own over the course of months then you'll have an environment that is better for bugs. You can still do some things to deter nuisance bugs such as making sure any kitchen scraps you put in the bin are pushed deep into the pile or are covered with something like dry grass clippings, thatch or fall leaves.
If you're doing active, hot composting which is a little more involved in terms of getting the right carbon to nitrogen ratio, making sure the pile has good air flow and turning it on a regular basis, the heat in the initial phases will kill not only weed seeds and some soil borne pathogens but also eggs of any insects that have been laid in the pile.
After the hot, active phase is over, some bugs may be attracted to the pile.
Insects aren't that big of a deal though in my experience. They like the pile so they don't venture too far away from it. If you put your compost pile in an out of the way location you'll barely notice them unless you're going to add something to the pile or going to turn it.
Since they're so content in the pile they're not in other places in the yard. The only ones I notice are a half dozen or so flying ones when I check the bin if I forgot to bury kitchen scraps.
I would suggest to look at bokashi. This is not composting but fermenting the kitchen litter.
This will reduce the amount of bugs because it will smell less interesting to them.
There still will be critters that love to eat this bokashi: worms.
Empty a bokashi bucket into the soil and the worms will do the rest. Happy plants, happy critters, happy people. Win-win-win.
And it's way easier than active or passive composting too.
Try Diatamaceous Earth (Food Grade) if you are concerned about bugs in the bin. Other options to consider are homemade gnat traps using plastic bottles where you can trap the fungus gnats. You can search online for how to easily make the traps.
You can also freeze or microwave the vegetable/fruits before putting them in the bin to destroy the eggs that are laid on bananas and fruits. For us it is usually fruits where we have the problem.
Few suggestions from someone that had been in a similar situation. I ended up purchasing a closed compost bin to hopefully reduce the bugs. As mentioned, you will have bugs so you can't totally avoid them but reduce it by covering up the bin. Secondly, don't put meat and other kitchen was in the compost. It will likely attract rodents as well.