The chemical reactions and pathways involving citrate, 2-hydroxy-1,2,3-propanetricarboyxlate. Citrate is widely distributed in nature and is an important intermediate in the TCA cycle and the glyoxylate cycle.