[clause],好在 + [clause]
好在 opens a clause that names a favourable condition inside a bad situation. The problem comes first, and 好在 offers the consolation. It belongs to speech and informal writing.
The condition is often something that was there all along – a feature, a fact – rather than a lucky break at the last minute.
幸好 credits luck for avoiding a bad outcome, and pairs readily with 不然. 好在 points to whatever softens a problem that has already arrived. Often either fits.
Without a difficulty to set it against, 好在 has nothing to soften.