Carpet Beetles begin outside by feeding on nectar and the pollen outdoors then they come into your home through cracks in the walls, doors, windows, foundations, holes where pipes run through etc.
The come into your home to seek warmth and then feed off the carpet and other fibers inside your home.
You can keep carpet beetles out of your home by sealing up any cracks that they may be getting through and hiring and exterminator to professionally get rid of the carpet beetles before they get too bad.
You can try home remedies but I had to get an exterminator in to eliminate the carpet beetles fully as they sprayed the outside of the home and even showed me cracks and places where they can be getting in and helped me seal them.
I paid around $250.00 for the carpet beetle extermination but it was well worth it and although some home remedies for getting rid of the carpet beetles helped some the exterminator was the way to go.