Vaccine is a preparation of antigenic proteins of pathogens or inactivated / weakened pathogen
introduced into the body
The antibodies produced in the body against these antigens would neutralise the pathogenic agents during actual infection , also generate memory B and T cells that recognise the pathogen quickly on subsequent exposure and overwhelm the invaders with a massive production of antibodies