Purchasing a duplex can work well as long as you can simply rent out the unit that you aren't living in. This assumes, of course, that you can qualify for the property. You need to be able to pay the mortgage for BOTH units, without a renter, so that you and the mortgage company are assured that the unit's being vacant will not send you into foreclosure.
In my city, duplexes are now being sold as semi-detached homes, aka townhouses. To buy both units, a mortgage is needed for each unit.