The spontaneous growth of GaN nanowires (NWs) in absence of catalyst is controlled by the Ga flux impinging both directly on the top and on the side walls and diffusing to the top. The presence of diffusion barriers on the top surface and at the frontier between the top and the sidewalls, however, causes an inhomogeneous distribution of Ga adatoms at the NW top surface resulting in a GaN accumulation in its periphery. The increased nucleation rate in the periphery promotes the spontaneous formation of superlattices in InGaN and AlGaN NWs. In the case of AlN NWs, the presence of Mg can enhance the otherwise short Al diffusion length along the sidewalls inducing the formation of AlN nanotubes.