The Draconic Bloodline sorcerer's 6th-level feature, Elemental Affinity, lets you add your Charisma modifier to the damage when you cast a spell. Does this count with cantrips such as fire bolt?
Yes it does, because cantrips are spells
Specifically, cantrips are 0th level spells. From the PHB:
Every spell has a level from 0 to 9. A spell's level is a general indicator of how powerful it is, with the lowly (but still impressive) magic missile at 1st level and the earth-shaking wish at 9th. Cantrips - simple but powerful spells that characters can cast almost by rote - are level 0.
Since cantrips are spells, and Elemental Affinity lets you add your Cha mod to damage when you cast a spell, Elemental Affinity applies to cantrips (that deal the appropriate type of elemental damage, of course).