Before Emperor Justinian built the Aya Sofya, he had to test out if the building would work structurally, so he built this miniature version first.
Its original name was the Church of Sergius and Bacchus, but the obvious architectural parallels with the Aya Sofya led to its long-held nickname becoming the building's official title.
During the Ottoman era, the church was converted into a mosque and it still functions as a working mosque today. Although its proportions aren't as grandiose as others in Istanbul, the building has been beautifully restored and is well worth a visit.