The caffeine in coffee “beans” is a natural plant defense against herbivory, i.e., a toxic substance that protects the seeds of the plant. Fruits and leaves are both sources of caffeine as well and a tea can be made of the leaves, but neither are used commercially.
Several insect pests affect coffee production, including the coffee borer beetle (Hypothenemus hampei) and the coffee leafminer (Leucoptera caffeina).
Coffee is used as a food plant by the larvae of some Lepidoptera (butterfly and moth) species, Dalcera abrasa, turnip moth and some members of the genus Endoclita, including E. damor and E. malabaricus.