If you want cosmetic protection then a product like Invisiframe is very good. These are bike model specific kits with pieces of transparent vinyl cut into shapes that fit together to allow the frame to be fully wrapped. They are relatively expensive for what they are ($100-120) and quite time consuming to apply to the frame. It is best done with the frame fully stripped of components and when you have hours and hours to devote to the job. The end result is after several years of use you can remove the wrapping and the frame will pretty much look new. This adds value if you plan on selling the bike or frame.
Most people don't go to that degree of protection. You can buy in bulk the same 3M product that Invisiframe and similar kits are made from then strategically apply it to a few areas on the frame. This would be the underside of the down tube, seat and chainstays, maybe backside of the seat tube, whatever. There are a number of Youtube videos demonstrating this, and they will tell you the product they use.
This stuff is all cosmetic. Scratches and scrapes in the paint will not affect the carbon fiber.