Food production depends upon the adequate provision of underpinning ecosystem services, such as pollination. Paradoxically, conventional farming practices are undermining these services and resulting in degraded soils, polluted waters, greenhouse gas emissions and massive loss of biodiversity including declines in pollinators. In essence, farming is undermining the ecosystem services it relies upon. Finding alternative more sustainable ways to meet growing food demands which simultaneously support biodiversity is one of the biggest challenges facing humanity. Here, we review the potential of urban and peri-urban agriculture to contribute to sustainable food production, using the 17 sustainable development goals set by the United Nations General Assembly as a framework. We present new data from a case study of urban gardens and allotments in the city of Brighton and Hove, UK. Such urban and peri-urban landholdings tend to be small and labour-intensive, characterised by a high diversity of crops including perennials and annuals. Our data demonstrate that this type of agricultural system can be highly productive and that it has environmental and social advantages over industrial agriculture in that crops are usually produced using few synthetic inputs and are destined for local consumption. Overall, we conclude that food grown on small-scale areas in and near cities is making a significant contribution to feeding the world and that this type of agriculture is likely to be relatively favourable for some ecosystem services, such as supporting healthy soils. However, major knowledge gaps remain, for example with regard to productivity, economic and employment impacts, pesticide use and the implications for biodiversity.Publisher's Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.