There are three main reasons your door is rattling.
Front door not locking from inside.
First you will need to work on removing the broken key pieces from within the keyway of your door lock.
When the door is shut the striker.
If you re referring to a upvc door then the chances are that the internal half of the euro cylinder has something faulty with it.
If a strike plate is recessed as often happens when the doorway is painted several times remove the screws pull it out and make cardboard shims to fit in the mortise.
The strike plate is recessesd the latch bolt does not align or the strike plate needs to be reset.
Have you had a new cylinder fitted.
Warping if the door cannot physically lock due to the frame or door being warped an adjustment of the strike plate could rectify the problem without the need of a new lock.
To resolve the issue of not being open from the inside check for issues in the power locking system.
In cases of accidental locking these unlock from outside of the room using a coin or stiff push pin.
Privacy door knobs are locks for the doors in your home.
It may require repair or replacement.
This entire process is easily done with the door panel removed.
These are relatively cheap to replace although i would recommend ensuring it has at least a 1 star rating and best of all a 3 star rating.
Key will not work if you ve had a new spare key cut recently it could be a poorly cut key causing the problem.
Test it with a spare key and make sure that.
Privacy door knobs have a push lock or twist lock on the inside of the room.
And finally check the lock assembly for broken parts and double check the door lock motor.
Quite easy to replace but if in any doubt call a locksmith.
Not for high level of security needed for exterior doors.
You will find deadlatches commonly referred to as nightlatches and yale locks as well.
A rim automatic deadlatch nightlatch is fitted on the inside of your door with the key locking cylinder to insert your key to open the door located on the outside of the door.
Sticking door locks can be attributed to everything from slight settling of the house to a buildup of dust and dirt within the locking mechanism.
The striker fails to penetrate into the door jamb because the door or the door jamb has become warped or the screws have loosened and the plate has moved.
Locked and unlocked from both sides with a key inserted in a rim cylinder.