I’m going to toss this out, and it’s not directed at anyone specifically...more of a general observation.
I think that we, as “students of the gun”, tend to focus on our armed response to a potential threat more than preventing it from getting to that point. I know I’m guilty of that myself—I have a couple of quick access pistols stashed around the house, as well as long guns.
But, as a friend once pointed out...if it gets to that point, you’ve already had major failures in your security plan. It's better to keep any potential threat outside your home—or, even better, make your home an obvious hard target, one that will get passed up for an easier target.
Well lit exteriors are a great start (I know that people who rent their homes may not have some of these options...but you may be able to find workarounds if you look). Harden your doors—reinforced frames/lockplates work incredibly well against the casual “mule kick” forced entry. Get shatter resistant film for ground level windows (and if you can, plant some type of pretty, but nasty, thorny vegetation below them...curb appeal AND defense in one package!) and glass patio doors.
Get an alarm system. Even for renters, something like SimpliSafe is affordable, portable when you move, and expandable if you buy a home later. We use it for our cabin...no complaints at all. Most importantly—advertise the alarm.
If you’re a dog person, and your lifestyle allows you to be able to have one...they’re a great alarm. As to them being an...”active” defensive measure, that’s a possibility as well.
Cameras have been brought up, and are good options. Both obvious and not so obvious make a good combination so “dead spots” in coverage aren’t exploited.
I'm firmly in the camp of the best way of surviving a gunfight is to not get in one...unless it's unavoidable. Hopefully, things I’ve mentioned above will help avoid one.