This book intends to construct a theory of modular forms for families of Calabi-Yau threefolds with Hodge numbers of the third cohomology equal to one. It discusses many differences and similarities between the new theory and the classical theory of modular forms defined on the upper half plane. The main examples of the new theory are topological string partition functions which encode the Gromov-Witten invariants of the mirror Calabi-Yau threefolds. It is mainly written for two primary target audiences: researchers in classical modular and automorphic forms who wish to understand the q-expansions of physicists derived from Calabi-Yau threefolds, and mathematicians in enumerative algebraic geometry who want to understand how mirror symmetry counts rational curves in compact Calabi-Yau threefolds. This book is also recommended for mathematicians who work with automorphic forms and their role in algebraic geometry, in particular for those who have noticed that the class of algebraic varieties involved in their study is limited: for instance, it does not include compact non-rigid Calabi-Yau threefolds. A basic knowledge of complex analysis, differential equations, algebraic topology and algebraic geometry is required for a smooth reading of the book.