The first part of the Middle Ages saw very little building of anything but houses in western Europe, as people struggled to adjust to the fall of Rome. People built some small churches here and there in the Visigothic, Vandal, and Merovingian kingdoms, but not much else.
In the eastern Mediterranean, however, the Roman emperors built great churches and palaces, like Hagia Sophia in Constantinople (Istanbul) about 550 AD. In Italy, the Ostrogoths built churches and palaces too. And when the Arabs conquered the southern and eastern Mediterranean in the late 600s AD, they also built great mosques and palaces, like the Dome of the Rock in Jerusalem. In 800, they built the great mosque in Kairouan.
By this time, Western Europe was also doing better. Charlemagne built himself a palace at Aachen, and a number of churches. His sons and grandsons built more churches. One of these is the Kastor church in Koblenz, finished in 836.
By 1000 AD or so, people began to build in the Romanesque style in Europe and people were building bigger churches, and more castles: among the churches, the baptistry at Pisa, St. Mark's in Venice, St. Germain des Pres and Toulouse in France are famous; there's an equally old church in Bremen, Germany. Among the palaces, the Tower of London and the Bromserburg, in Germany. In Spain, the Arab caliphs built the mosque at Cordoba. By 1100, the caliphs were also building castles.
In the 1100s, people built Romanesque churches in Germany, like the abbey church in Regensburg.
Around 1200 AD, people changed from the old Romanesque style to a new Gothic style: first in Italy, with the churches at Florence and Pisa, then in France, with the cathedrals of Laon, of Paris, of Chartres, of Rouen, of Reims, of Amiens, and finally in England with Westminster Abbey, in Germany with Munster, Regensburg, Bremen, Freiburg, and Cologne and in Italy with Milan. The Capetian kings of France built two castles in Paris: the Louvre and the Conciergerie, with the Sainte Chapelle, and another castle outside of Paris, Vincennes. In Germany, the Holy Roman Emperors built a castle at Heidelberg. After the Reconquista took over Spain from its Islamic rulers, a Gothic cathedral was built in Seville as well. The Gothic style lasted until the Renaissance ended the Middle Ages.
Beginning in the 1300s, people in Italy and Germany branched out from churches and castles to also build big town halls for public meetings, like the Rathauses in Munster, Munich, and Bremen in Germany and the Palazzo Vecchio in Florence, Italy.
While people were building these castles and cathedrals and town halls in western Europe, they were also building more mosques and palaces in the Islamic Empire at the same time.