Here is what I would personally do:
#1. Grab anything in the immediate area to be used as a defensive weapon. It could be anything, just grab it. There might not be time should they get through the door.
#2. Flip on all the light switches you can in immediate vicinity.
#3. Get to a defensive position and get the firearm if possible. Contact police if possible.
#4. Yell at the door in a commanding voice "Who is knocking on the door?"
This 4 step process should take seconds.
Remain in the defensive position. For me that would be at the top flight of my stairs and I would half duck behind the wall. The other half of my body would be pointed towards downstairs with my pistol.
There are many different factors and variables but I believe you must act quickly and aggressively. In the past when someone banged on my door late at night I yelled very aggressively "Who the (profanity) is there!!!" I used profanity because I wanted them to believe the guy behind the door wasnt going to be nice if they decided to enter.
Many different techniques and styles. Its good to do a few practice runs with a stopwatch. How fast can you react to a situation? Also time how fast it would take for someone to run up the stairs. You will find its a second or two and that is why i say to grab anything to use as an immediate weapon.
When I am sleeping my bedroom door is locked with a deadbolt and crossbar. They still might be able to kick it in but it wont be as easy as a regular bedroom door. I saw a video where this guy had a cargo net which could be lowered quickly over his stairs so as to contain the downstairs from the upstairs at night. The net had these chimes and bells on it so if anyone tried to take it down then it would be very noisy. No one could simply run up the stairs immediately at night.
Another thing to think about is the security screen doors which have deadbolts and steel frames. I have those and they work great. Stronger then the regular door.