In this paper we present a macroeconomic microfounded framework with heterogeneous agents – households, firms, banks – which interact through a decentralized matching process presenting common features across four markets – goods, labor, credit and deposit. We study the dynamics of the model by means of computer simulation. Some macroeconomic properties emerge such as endogenous business cycles, nominal GDP growth, unemployment rate fluctuations, the Phillips curve, leverage cycles and credit constraints, bank defaults and financial instability, and the importance of government as an acyclical sector which stabilize the economy. The model highlights that even extended crises can endogenously emerge. In these cases, the system may remain trapped in a large unemployment status, without the possibility to quickly recover unless an exogenous intervention.