Mosque ” Little Hagia Sophia ” (in Turkish: Küçük Ayasofya Camii) was previously the church of Saints Sergius and Bacchus. The Greek Eastern Orthodox Church was transformed into a mosque during the Ottoman Empire in the early 16th century.
The original church was built between 527 and 536 AD. to serve the palace of Ormisdas and was originally named after two Roman soldiers, Sergius and Bacchus. They martyred for their faith, and then became patrons of Christians in the Roman army. It was commissioned by Justinian shortly before the construction of the Hagia Sophia and is believed to have been designed by the same architects.

The church remained untouched for sixty years after the conquest of Constantinople in 1453. He was turned into a mosque by Hussein Agha, who was the chief black eunuch at Topkapi Palace. A portico and madrasa (school) were added at this time.
Like most Byzantine churches of this era, appearances are an unassuming brick, and only once inside proportions can they be correctly assessed. It is basically an octagon with semicircular niches on the diagonal, inscribed in a rectangle. Nothing remained of the original decoration of the interior of the church, which, as they said, was covered with mosaics. During the transformation into a mosque, the windows and the entrance hall were changed, the floor level was raised, and the inner walls were plastered.
Being the first domed church immediately preceding Hagia Sophia, it is considered one of the most important buildings in the development of Byzantine architecture in Istanbul.
Opposite the entrance to the mosque is a madrasaH. The yard now serves as a shady tea garden.
Source: The Rough Guide to Istanbul, Wikipedia