The study of the small molecules produced by an organism or species, including their roles in metabolism and signaling.