Buying a home - how early is too early?

I bought my house a few years ago when I was 24 and had just started a PhD program.

I had the money, and many years of guaranteed income and figured why not.

I also wanted to buy it before I got married because my credit was so strong and my now-husband had no credit whatsoever.

I wouldn’t buy unless you know you’re going to be in an area for at least 5+ years or you know the area very well. I moved back to where I went to high school and knew I wanted to raise a family there.