Good piece on CNET
https://www.cnet.com/how-to/how-to-build-home-gym/
Work with the space you have
I once lived in a tiny studio apartment where doing yoga meant pushing the couch into the bedroom area every single time. Suffice to say, my main workout was running around my neighborhood.
If you have plenty of extra space for a gym, you have lots of options. But when space is limited, the key is to pick workouts that don't need a lot of it.