The most flourishing age of Trani was the 11th century, when it became an episcopal see in place of Canosa, destroyed by the Saracens. Its port, well placed for the Crusades, then developed greatly, becoming the most important on the Adriatic Sea. In the year 1063 Trani issued the Ordinamenta et consuetudo maris, which is "the oldest surviving maritime law code of the Latin West".
In that period many great families from the main Italian Maritime Republics (Amalfi, Pisa, Ragusa and Venice) established themselves in Trani. Trani, in turn, maintained a consul in Venice from 12th century.
The presence of other consulates in many northern Europe centres, even in England and Netherlands, shows Trani's trading and political importance in the Middle Ages. Emperor Frederick II built a massive castle in Trani. Under his rule, in the early 13th century, the city reached its highest point of wealth and prosperity.