Schematic diagram of local defense mechanisms of an insect model against pathogenic bacteria. The cuticle is a first barrier, which can be overcome through spiracles or injury. To cause infection, ingested pathogens must overcome various physical barriers, such as peritrophic membrane, epithelium, peristalsis and commensal microbiota, as well as chemical defenses present in the digestive system as pH, proteases, cell receptors and antimicrobial compounds. In addition, the commensal microbiota provides a competitive environment for the pathogen establishment, and also produces antimicrobial compounds that hinder the pathogenic action. Much of the toxins secreted by pathogens require specific receptors to perform their functions; changes in these receptors allow development of insect resistance to pathogens. Finally, after overcoming all these defenses, the pathogen must still deal with the innate immune system and circulating haemocytes to succeed with an infection.