Rapid urban densification in cities of the Global South has intensified land scarcity and constrained the provision of green open spaces, particularly in compact residential neighborhoods. In such contexts, community-based urban agriculture has emerged as an adaptive response to environmental, social, and spatial challenges. While existing studies widely acknowledge the multifunctional benefits of urban agriculture, empirical investigations that systematically examine its spatial logic and integration within dense built environments remain limited, especially in Southeast Asian cities. This study aims to reframe community-based urban agriculture as an integrated socio-spatial and environmental infrastructure embedded within compact urban fabrics. Using a case study approach, the research investigates urban agriculture practices in Kemantren Gondokusuman, Yogyakarta, Indonesia. Data were collected through field mapping, spatial documentation, and descriptive–quantitative analysis focusing on spatial typologies, distribution patterns, green open space ratios, and system integration. The results identify 22 spatially distributed urban agriculture sites operating across private yards, residual spaces, and communal facilities, with a density of approximately 0.055 sites/ha in an area characterized by a green open space provision of only 14.5%. Findings reveal that urban agriculture functions as a micro-scale environmental infrastructure through the integration of spatial efficiency, production systems, environmental functions, and community-based operational mechanisms. Rather than compensating for green space deficits through land expansion, environmental performance is achieved through functional intensification of fragmented spaces. The study proposes an integrated urban agriculture model that synthesizes these interdependent systems, contributing a design-oriented framework for sustainable built environments in dense urban neighborhoods. This research advances-built environment sustainability discourse by demonstrating how urban agriculture can operate as a scalable, spatially integrated strategy for enhancing environmental and socio-spatial performance in compact cities.