Berberine could (maybe, perhaps, possibly --- do your own research) potentially be a safer alternative to meformin.
Berberine may also help prevent other illnesses as well.
It's available off the shelf (iHerb). Not by prescription.
Your doctor is unlikely to know what it is or recommend it.
If you decide to get off metformin and try berberine, always need to research if it interacts with any other medications you are taking.
Perhaps you can hire an online Naturopath for guidance if you want to go down that road.
https://warnerorthopedics.com/is-berberine-a-safe-alternative-to-metformin/