This technology combines genetically engineered cells with a tough hydrogel material. The hydrogel is composed of 70-90% water with a biocompatible structural matrix, and the resulting hydrogel has a strength and elasticity similar to natural rubber. The hydrogel additionally contains the nutrients required by the cells for survival and allows transfer of chemical signals through the matrix. This technology provides both physical containment through motility restriction and chemical biocontainment by auxotrophy to prevent distribution of genetically engineered cells. The hydrogel has the capacity to be tailored to bacterial, yeast, or mammalian cells. Potential applications include (1) wearable, implantable, or ingestible health biosensors to detect inflammation, bleeding, or disease biomarkers, (2) environmental detection of toxins, and (3) controlled distribution of environmentally functional cells, for example, nitrogen fixing bacteria.