I've been teaching self-defense courses since the 1970s, and this is not an easy question to answer due to all the variables involved. Here are some general guidelines/considerations:
1. Remember that if you are going to use this gun for home defense, it's likely going to be sitting stashed somewhere for long periods of time. Most people will say they'll practice with it, but practice tends to go away within a few months of purchase, so you want a gun that's easy to use the first time or a year from now.
2. Who's the gun for? Like electronics, guys tend to gravitate towards guns with lots of functions and controls, while women want simplicity. If your wife or girlfriend will be using it, you better go with a revolver.
3. Many people like the higher capacity of a pistol, but the truth is if you can't hit your target with the five or six shots from most revolvers, and the bad guy hasn't been scared off by your first shots, having another nine or so shots isn't likely to help. Also, in panic situations, which these usually are, your initial reflex is likely going to be to fire-to-empty and a 15-shot pistol magazine isn't much better than a six-shot revolver cylinder at that point.
4. What do you plan to do with the gun? I've had lots of guys tell me they use an AR-15 carbine, AKM, or shotgun for home defense, and I've had to tell them that's a bad idea for two reasons. First, if you're checking out your house, a bad guy can take control of a long gun very easily as you turn a bend or enter a room simply by grabbing the end of the barrel. Once he/she has the end of the barrel under their control, they can use it as a lever against you and you're holding onto 6-9 pounds of worthless metal at that point. Second, firing these weapons requires the use of both hands. If you are blitzed by an attacker, you will instinctively be using your strong hand to fend them off. No amount of training can stop that instinctive response. You need to always keep in mind the bad guy won't always just stand there and make like a target, so you need a weapon you can fire using just your weak hand.
5. Expounding on item 4, and the need to have a weapon you can use with your weak hand, if you are right handed, you need a revolver or a pistol with no safety (Sig Sauer, Glock, etc.), or an ambidextrous safety (Beretta or Taurus 92/96 series are the most popular). If you are left handed, you can use just about anything.
6. Never, ever, use a flashlight!!! I keep seeing guys buying shotguns or ARs and hanging "tactical flashlights" on them, and they're about the dumbest things ever! Any flashlight reveals more to the bad guy than it does to you because they can see the beam moving, and where it's going, long before you can see them in the beam. Flashlights like these are for guys entering buildings or areas they are not familiar with, and fall into the category of better than nothing. You know your house. You know where the light switches are, where the shadow areas are, etc., so use your house illumination as it reveals much less to an opponent than a flashlight beam.
7. As for selecting the ideal ammunition, the general consensus is to use 38 Special for a revolver, or 9MM for a pistol. Both are common, cheap, and readily available. .45 ACP offers more energy transfer and lower velocity, which is better in a home environment, but the downside is you're usually limited as a right-handed shooter to a Sig Sauer p220 or Glock 21 series pistols since most off-the-shelf 1911-series pistols have left-sided frame safeties only.
I've used two handguns for home defense and concealed carry. One is a Smith & Wesson Model 19 revolver, and the other is a Sig Sauer P226 in 9MM. I usually practice shooting these guns left-handed only since I'm right handed, and have worked to develop my skills and accuracy with these guns with my weak hand.
One last thing. If you have kids in the house, forget about hiding your gun, or trigger locks, safes, or keeping it unloaded. There is no place in your house your kid(s) won't find a need to get, or look into, over time. They'll find some reason to look in the back of the top of the closet, under the mattress, behind the nightstand, etc., so hiding your gun doesn't work. And trigger locks, safes, and keeping the gun unloaded make them safer, but a gun that isn't ready for action 24/7 isn't much use to you when it comes to home defense. Opening a safe, or taking off a trigger lock is easy... until you have to do it as you're hearing your wife and kids screaming, glass breaking, footsteps coming down the hall, etc.
If you have kids, the safest thing you can do is educate them! Take them with you to the range, and have them stand with you when you're shooting. The noise alone is enough to convince younger kids this is nothing they want to play with. If your kids are older, say four or older, let them shoot the gun AND make them clean it afterwards. Nothing deters a kid's interest in something more than having them see it as a chore.
Most in-house shootings involving kids occur because the kids find that "well-hidden" gun, and their only knowledge of guns is from TV and movies. They have no real concept of what the gun can do, or how to tell if it's loaded or safely handle it, because their parents chose not to educate them and felt trusting to ignorance and luck was a better idea. So, the kids think the real gun is like their play guns or the ones on TV, and wham... someone gets shot. Educating your kids, and de-mystifying your guns for them, is way and by far the safest thing you can do if you've got kids at your house.