1st and foremost get some training.
2nd know your local and federal laws.
All that aside there is really two main considerations to HD in my mind and that is Power vs. Availability.
I am a big fan of the ole' 12 gauge shotgun for any HD range scenario. The launching platform is generally pretty irrelevant as long as it is a quality piece. Remington, Mossberg, Ithica, Benelli, Beretta etc. The problem with a shotgun or any long arm is they are not easy to keep handy at all times.
Based on that I personally think if you are only going to have one HD gun I would suggest a 3-6 inch .357 magnum revolver. Load it with .38 +P and practice practice practice. The reason for this is that you can keep that revolver near you at all times and in a home invasion scenario things can be done and over with in literally seconds. You may not have time to move from living room to whatever room has the shotgun/longarm. I have experienced this first hand several times as an emergency communication operator.
A good .357 revolver gives you a very reliable, inexpensive, versatile platform. You have the option of shooting the most mild .38 specials all the way up to fire breathing wrath of God .357 loads. You can load up snake shot if need be and you should never have any problems feeding any type or shape of bullet that will fit.
Revolvers are easy to load, unload and visually inspect. They may not be as sexy as black plastic but they still work and in many cases work even better then a bottom feeder alternative.
Just remember.
Training first.
Local and state laws on ownership and use second.
Try and buy the gun the fits you.
Buy the proper cleaning kit and materials. Learn to keep your weapon clean and in tip top shape.
Factor in safe storage when you are not in control of the weapon.
Practice, practice, practice, train, practice, train, practice.
Oh about that practice part, we call that fun around here.