Anas bin Malik reported,

The Prophet ﷺ arrived in Medina and stayed in the upper part of the city among a clan called Banu Amr bin Awf. He remained with them for fourteen nights, then sent for Banu Najjar, who came wearing their swords. It is as if I can still see the Prophet ﷺ on his mount with Abu Bakr riding behind him and the chiefs of Banu Najjar gathered around him, until he dismounted in the courtyard of Abu Ayub.The Prophet ﷺ used to love praying wherever the time of prayer found him, and he would pray in the folds where sheep were kept. Then he ordered that a mosque be built. He sent for the chiefs of Banu Najjar and said, "Banu Najjar, name me a price for this orchard of yours."They replied, "No, by Allah, we seek its price only from Allah."Anas said, In it was what I will now describe to you. There were graves of polytheists, ruins, and date palms. The Prophet ﷺ ordered that the graves of the polytheists be dug up, the ruins leveled, and the palms cut down. They lined up the palm trunks as the qiblah wall of the mosque and made its doorposts of stone. They began carrying the stones while chanting work songs, and the Prophet ﷺ was with them, saying, "O Allah, there is no good except the good of the Hereafter, so forgive the Ansar and the Muhajirun."

Azami 3065

Sahih

عن أنس قال

قدم النبي ﷺ المدينة فنزل أعلى المدينة في حي يقال لهم بنو عمرو بن عوف، فأقام النبي ﷺ فيهم أربع عشرة ليلة، ثم أرسل إلى بني النجار فجاءوا متقلدى السيوف، كأني أنظر إلى النبي ﷺ على راحلته وأبو بكر ردفه وملأ بني النجار حوله، حتى ألقى بفناء أبي أيوب، وكان يحب أن يصلي حيث أدركته الصلاة ويصلي في مرابض الغنم، وأنه أمر ببناء المسجد، فأرسل إلى ملإ من بني النجار فقال: يا بني النجار ثامنوني بحائطكم هذا. قالوا: لا والله لا نطلب ثمنه إلا إلى الله. فقال أنس: فكان فيه ما أقول لكم: قبور المشركين، وفيه خرب، وفيه نخل، فأمر النبي ﷺ بقبور المشركين فنبشت، ثم بالخرب فسويت، وبالنخل فقطع فصفوا النخل قبلة المسجد، وجعلوا عضادتيه الحجارة، وجعلوا ينقلون الصخر وهم يرتجزون، والنبي ﷺ معهم وهو يقول: اللهم لا خير إلا خير الآخرة فاغفر للأنصار والمهاجره.

الأعظمي 3065صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Mosques
Section
Building the masjid of the Messenger of Allah ﷺ
Numbering
Jami al-Kamil 3065 (2nd edition)
Azami 3065