• A digital methodology for environmental performance analysis of urban buildings is proposed. • An automated workflow was run over 2187 iterations to inform the best energy performing urban residential buildings. • Results show the important role of BIPV technology in shifting towards nearly Zero energy districts. • Indicators for the energy performance of urban buildings with one-hour, one-month, and one-year resolution data. • Performance Indicators analyzed cover many aspects: thermal indoor comfort, visual comfort, energy needs, solar production and load match. • Influence of the urban residential building's morphological parameters on the energy performance metrics in the Mediterranean climate. • The proposed graphs provide a useful way to concentrate a large quantity of information and highlight the relevance of data science. Given the looming threats of climate change and the rapid worldwide urbanization, it is a necessity to prioritize the transition towards a carbon-free built environment. This research study provides a holistic digital methodology for parametric design of urban residential buildings with regard to the Mediterranean semi-arid climate zone of Morocco in the early design phase. The morphological parameters of the urban residential buildings, namely the buildings' typology, the distance between buildings, the urban grid's orientation, and the window-to-wall ratio, are evaluated in order to identify the key combinations of passive and active solar design strategies that determine the high energy performing configurations, based on the introduced Energy Performance Index (EPI), which is the ratio between solar BIPV production to maximum available installed BIPV capacity and the normalized thermal energy needs. Through an automated processing of 2187 iterations via Grasshopper, we simulate daylight autonomy, indoor thermal comfort and solar rooftop photovoltaic and building integrated photovoltaic (BIPV) energy potential. Then, we analyze the conflicting objectives of energy efficiency measures, active solar design strategies, and indoor visual comfort in the decision-making process that supports our goal of getting closer to net zero urban residential buildings. The digital workflow showed interesting trends in reaching a balanced equilibrium between performance metrics influenced by the contrasting impact of solar exposure on indoor daylight autonomy and thermal energy demand. Furthermore, the study's findings indicate that it is possible to achieve an annual load match exceeding 66,56 % while simultaneously ensuring an acceptable visual indoor comfort (sDA higher than 0.4). The findings also highlight the important role of the BIPV system in shifting towards the net zero energy goal, by contributing up to 30 % of the overall solar energy output and covering up to 20 % of the yearly self-consumption. Moreover, the energy balance evaluation on an hourly basis indicates that BIPV system notably enhances the daily load cover factor by up to 5.5 %, particularly in the case of slab SN typology, throughout the different seasons. Graphical representations of the yearly, monthly and hourly load matches and the hourly energy balance of the best performing configurations provide a thorough understanding of the potential evolution of the urban energy system over time as a result of the gradual integration of active solar electricity production. [ABSTRACT FROM AUTHOR]