We have developed an analytic model that explains the self-ordering of nanostructures taking place during epitaxial growth on corrugated substrates. The growth rate transients leading to self-limiting growth are due to lateral gradients of the surface chemical potential on the nonplanar surface profile. Chemical potential variations due to both surface curvature and nonuniform alloy composition (related to the entropy of mixing) are considered. We show that a necessary condition for obtaining a self-limiting growth inside a groove or on top of a ridge is the occurrence of growth rate anisotropy between the sidewalls and the bottom or top facets, respectively. The model explains the different self-limiting growth behavior observed in molecular beam epitaxy and organometallic chemical vapor deposition on corrugated surfaces of different orientations.