I've made a number of boxes with simple fitted lids. The first time is a bit intimidating, but once you do a few, you develop a technique that makes the next batch pretty easy. One of the issues with these is security - will the cap remain attached as the box is handled? I have a couple in my travel backpack that seem to work OK, but ultimately it comes down to how snugly the cap fits. And of course, wood moves so it may fit well today, but not tomorrow.
I've also made a few boxes where I have incorporated male and female threads salvaged from polystyrene medicine containers. It's important to use polystyrene containers because components made from other plastics can't be glued to wood. Specifically, the containers that I used were intended for cleaning and storing contact lenses. There are videos out there about using PVC plumbing fittings, but they are bulky and that inherently increases the practical size of the box that can be made (the last video I saw on this technique was on making funeral urns). Ultimately, the limitation with this approach is finding a suitable plastic container from which gluable threads can be salvaged, and my experience is that the choice is fairly limited.
I've seen threaded brass bushings in catalogs (I think it was Lee Valley), but they were pretty pricey.
Alan's idea of using 3D-printed plastic threaded or bayonet fittings is great, but you have to have access to a 3D printer and the appropriate design software.
But I wonder if there is a potential market out there for 3D-printed bayonet fittings?
UPDATE: Alan just posted another video on 3D-printed bayonet bushings. And also announced that he is now selling them via his Etsy site,
https://www.etsy.com/shop/AsWoodTurnsTools.