Short-period super-Earths and sub-Neptunes are the most abundant type of planets. Their origin is key to understanding planet formation and the evolution of protoplanetary disks. Recent observations found that, contrary to mature systems, young planetary systems appear to be dominated by near-resonant configurations, suggesting a rich history of resonance capture followed by secular dynamical instabilities. In this talk, I will present our latest explorations on pathways to form and to knock close-in planetary systems. I will also discuss the implications and connections to the observed distributions of orbital period ratios as well as transit time variation phases, and the lack of strong dependence on host metallicity.