Epithelial organoids, such as those derived from stem cells of the intestine, have great potential for modelling tissue and disease biology1–4. However, the approaches that are used at present to derive these organoids in three-dimensional matrices5,6 result in stochastically developing tissues with a closed, cystic architecture that restricts lifespan and size, limits experimental manipulation and prohibits homeostasis. Here, by using tissue engineering and the intrinsic self-organization properties of cells, we induce intestinal stem cells to form tube-shaped epithelia with an accessible lumen and a similar spatial arrangement of crypt- and villus-like domains to that in vivo. When connected to an external pumping system, the mini-gut tubes are perfusable; this allows the continuous removal of dead cells to prolong tissue lifespan by several weeks, and also enables the tubes to be colonized with microorganisms for modelling host–microorganism interactions. The mini-intestines include rare, specialized cell types that are seldom found in conventional organoids. They retain key physiological hallmarks of the intestine and have a notable capacity to regenerate. Our concept for extrinsically guiding the self-organization of stem cells into functional organoids-on-a-chip is broadly applicable and will enable the attainment of more physiologically relevant organoid shapes, sizes and functions.