Organ-on-chips are miniaturized devices that arrange living cells to simulate functional subunits of tissues and organs. These microdevices provide exquisite control of tissue microenvironment for the investigation of organ-level physiology and disease. A 3D polarized epithelium using primary human or mouse gastrointestinal stem cells was developed to fully recapitulate gastrointestinal epithelial architecture and physiology. A planar monolayer comprised of stem/proliferative and differentiated primary cells is cultured on a shaped hydrogel scaffold with an array of crypt-like structures replicating the intestinal architecture. Imposition of chemical gradients across the crypt long axis yields a polarized epithelium with a stem-cell niche and differentiated cell zone. The stem cells proliferate, migrate and differentiate along the crypt axis as they do in vivo. A dense mucus layer is formed on the luminal epithelial surface that is impermeable to bacteria and acts a barrier to toxins. An oxygen gradient across the tissue mimic permits luminal culture of anaerobic bacteria while maintaining an oxygenated stem cell niche. This in vitro human colon crypt array replicates the architecture, luminal accessibility, tissue polarity, cell migration, and cellular responses of in vivo intestinal crypts. Intestinal biopsy samples can be used to populate these constructs to produce patient-specific tissues for personalized medicine and disease modeling. This bioanalytical platform is envisioned as a next-generation system for assay of microbiome-behavior, drug-delivery and toxin-interactions with the intestinal epithelia.