The present invention provides azetidinyl phenyl, pyridyl, or pyrazinyl carboxamide derivatives of formula (I), as well as their compositions and methods of use, that modulate the activity of Janus kinase (JAKs) and are useful in the treatment of diseases related to the activity of JAK including, for example, inflammatory disorders, autoimmune disorders, cancer, and other diseases.