The immune system is a host defense system comprising many biological structures and processes within an organism that protects against disease.
The bodily system that protects the body from foreign substances, cells, and tissues by producing the immune response and that includes especially the thymus, spleen, lymph nodes, special deposits of lymphoid tissue (as in the gastrointestinal tract and bone marrow), macrophages, lymphocytes including the B cells and T cells, and antibodies. 
The role of the immune system — a collection of structures and processes within the body — is to protect against disease or other potentially damaging foreign bodies. When functioning properly, the immune system identifies a variety of threats, including viruses, bacteria and parasites, and distinguishes them from the body's own healthy tissue. 
The immune system can be broadly sorted into categories: innate immunity and adaptive immunity.
Innate immunity is the immune system you're born with, and mainly consists of barriers on and in the body that keep foreign threats out, according to the National Library of Medicine(NLM). Components of innate immunity include skin, stomach acid, enzymes found in tears and skin oils, mucus and the cough reflex.
Innate immunity is non-specific, meaning it doesn't protect against any specific threats.
Common disorders of the immune system
It is common for people to have an over- or underactive immune system. Overactivity of the immune system can take many forms, including:
· Allergic diseases
· Autoimmune diseases
Major components of Immune system
Antibodies help the body to fight microbes or the toxins (poisons) they produce. They do this by recognizing substances called antigens on the surface of the microbe, or in the chemicals they produce, which mark the microbe or toxin as being foreign. The antibodies then mark these antigens for destruction. There are many cells, proteins and chemicals involved in this attack.
The complement system is made up of proteins whose actions complement the work done by antibodies.
The spleen is a blood-filtering organ that removes microbes and destroys old or damaged red blood cells. It also makes disease-fighting components of the immune system (including antibodies and lymphocytes).
Bone marrow is the spongy tissue found inside your bones. It produces the red blood cells our bodies need to carry oxygen, the white blood cells we use to fight infection, and the platelets we need to help our blood clot.
Lymphocytes: These small white blood cells play a large role in defending the body against disease, according to the Mayo Clinic. The two types of lymphocytes are B-cells, which make antibodies that attack bacteria and toxins, and T-cells, which help destroy infected or cancerous cells. Killer T-cells are a subgroup of T-cells that kill cells that are infected with viruses and other pathogens or are otherwise damaged. Helper T-cells help determine which immune responses the body makes to a particular pathogen.
The body's other defences against microbes
As well as the immune system, the body has several other ways to defend itself against microbes, including:
Healthy ways to strengthen your immune system
5 signs of a weak immune system
The best medicine for immune system
Milestones in the history of immunology
1718: Lady Mary Wortley Montagu, the wife of the British ambassador to Constantinople, observed the positive effects of variolation — the deliberate infection with the smallpox disease — on the native population and had the technique performed on her own children.
1796: Edward Jenner was the first to demonstrate the smallpox vaccine.
1840: Jakob Henle put forth the first modern proposal of the germ theory of disease.
1857-1870: The role of microbes in fermentation was confirmed by Louis Pasteur.
1880-1881: The theory that bacterial virulence could be used as vaccines was developed. Pasteur put this theory into practice by experimenting with chicken cholera and anthrax vaccines. On May 5, 1881, Pasteur vaccinated 24 sheep, one goat, and six cows with five drops of live attenuated anthrax bacillus.
1885: Joseph Meister, 9 years old, was injected with the attenuated rabies vaccine by Pasteur after being bitten by a rabid dog. He is the first known human to survive rabies.
1886: American microbiologist Theobold Smith demonstrated that heat-killed cultures of chicken cholera bacillus were effective in protecting against cholera.
1903: Maurice Arthus described the localizing allergic reaction that is now known as the Arthus response.
1949: John Enders, Thomas Weller and Frederick Robbins experimented with the growth of polio virus in tissue culture, neutralization with immune sera, and demonstration of attenuation of neurovirulence with repetitive passage.
1951: Vaccine against yellow fever was developed.
1983: HIV (human immunodeficiency virus) was discovered by French virologist Luc Montagnier.
1986: Hepatitis B vaccine was produced by genetic engineering.
2005: Ian Frazer developed the human papillomavirus vaccine. 
See also: Health care; Lifestyle; Protection; Stamina