There are watertight buckets and wormeries
you can buy in suitable shops,
which is good if you haven't got a garden.
If you have a garden,
then make a compost, and worms will come anyway.
Not forgetting that worms are not necessary. Composting is mostly bacterial and fungal:
Just put things in a pot,
and it'll degrade most admirably in quite a short period, worms or no worms.
In this place I live in, we have composting.
The three hundred or so souls,
most with shared kitchens,
are provided with indoor composting bins.
These are ... well bins, with lids, which are emptied regularly.
That's at least once a week, or whenever it fills up.
First thing is what is composted:
Only vegetable matter.
No meat, because it's smelly, and attracts predators, including rats, and no bread, for similar reasons.
Fruit: as little as possible because they create clouds lots of midges - it's the sugar content.
Try and chop things a little.
Small bits compots quicker because of greater surface area exposed to composting bacteria.
So all these bins are regularly emptied bins which are simply faur wooden palens arranged in a square straight on the ground, and a wooden lid on top. A wooden box without a floor.
Next when you empty the bin, mix it around a bit with a stick. After this, you can, if you wish, sprinkle a little "dry matter" on top, which can be leaves, wood chips, that sort of thing. It's not essential but it helps keep the compost aerated.
Worms colonise this of their own accord, but worms are not essential: composting works perfectly well with no worms.
By these means, our 300 or so souls produce a few cubic metres of rich dark fertilising compost which is dragged off to the vegetable garden
a few hundred yards away.
And this grows fruit, vegetables, and herbs.
Final point: a well thought out compost produces no flies, and no smells other than a hint of good garden muskiness.