If the hard drive is failing you need to proceed carefully. You should first determine the condition of the drive and if it is failing, then how bad is the failure? If you attempt to copy data from a failing hard drive it can make the drive failure much worse very quickly since macOS and most data recovery apps cannot handle the hardware errors a failing drive produces.
If it were my system I would create a bootable Knoppix Linux USB drive using Etcher (Mac/Windows/Linux). Option Boot the USB drive and select the orange icon labeled "EFI". While Knoppix is booting the system may appear frozen on the Apple boot picker menu so make sure to give Knoppix lots of time to finish booting.
Once Knoppix boots to the desktop click on the "Start" menu located in the lower left corner of the Taskbar and navigate to "System Tools --> GSmartControl". Within the GSmartControl app double-click on the Mini's drive icon to access the hard drive's health information. Post the complete report here and I will review it for you.
If the drive failure isn't too severe, then I would try using Carbon Copy Cloner to make an image of the user account(s). I wouldn't image the whole drive since you know the system isn't booting which likely means some system files are damaged. You may be able to migrate the user accounts from the failing drive using Setup Assistant on the clean macOS install on the new SSD, but if it takes too long or produces too many errors you should stop it immediately as you are likely causing irreversible data loss.
If the drive failure is more severe, then the best way to recover the data is by performing a bit for bit clone of the drive. This requires another drive of equal or larger size to hold the temporary clone.
Of course using a professional data recovery service such as Drive Savers or Ontrack is the safest way of recovering data from a failing hard drive. Both vendors provide free estimates and both are recommended by Apple.
You need to choose wisely since you may only get one chance at recovering data from a failing hard drive.
FYI, I have successfully recovered data from hundreds of failing drives. Some of the drives were in such bad condition I didn't expect to be able to retrieve anything from them. I do greatly err on the side of caution when I perform data recovery.
You definitely want to have good verified working backups when using an SSD since data recovery from an SSD is nearly impossible. SSDs can fail at any time without any warning signs.