Early Medieval Venice
During the fall of the Roman Empire, in the 400s AD, people who lived along the north-east coast of Italy didn't feel safe. Central Asian people like the Huns and Germanic people like the Ostrogoths were invading over and over again. Some people abandoned their homes and moved to wetlands and islands in the area that is now Venice, where invaders couldn't get to them so easily.
Each disaster after that convinced more people to move to Venice. The plague of 542 AD may have convinced more people to move to Venice to get away from the plague. Then the Central Asian Avars and Slavs pushed the Lombards to invade Italy in 568 AD. Venice, far to the east, remained part of the Roman Empire. More people fled from the Lombards and seem to have settled in Venice. Only a few years later, the Slavs and the Avars invaded Greece, and more people fled to Venice. A little after 700, Venice had gotten big enough that the people of Venice elected a dux - a leader - to rule them.
In the early 800s, Charlemagne invaded Italy, but he signed a treaty with Emperor Nicephorus that left Venice still part of the Roman Empire. But by this time the Roman Empire didn't have much power, and Venice gradually became more and more independent, balancing its allegiance between the Roman Empire to the east and the Holy Roman Empire to the west. Like its neighbors in Syria and Egypt, Venice began to make glass to sell on the Silk Road. By about 1100 AD, Venice was an independent republic like Florence, Genoa and Pisa. Venice developed a great navy, and cleared the eastern Mediterranean of pirates. Soon a lot of the trade between the Silk Road and Europe - cotton, silk, horses, spices like cinnamon and pepper, paper, glass, and steel - passed through Venice, and Venetian traders got richer and richer.