The bacterial envelope consists of a plasma membrane surrounded by a cell wall. The plasma membrane consists of a phospholipid layer with several embedded proteins facilitating cell signaling and transport. The main function of the plasma membrane is to protect the cell from the extracellular environment by regulating the transport of substances and molecules in and out of cells.
The primary function of the cell wall in prokaryotes is to protect the cell from the pressure exerted by much higher concentrations of proteins and molecules inside the cell compared to the extracellular environment. The cell wall also provides the shapes of the bacteria.
There are two main types of bacterial walls which are differentiated by their gram-staining characteristics: the gram-positive cell wall and the gram-negative cell wall. The gram-positive cell wall has a thick layer of peptidoglycan, whereas a gram-negative cell wall has a thin peptidoglycan layer and an outer membrane.
Some bacteria contain a capsule that surrounds the cell wall which can help cells adhere to surfaces. Capsules are relatively impermeable and are made of polysaccharides and sometimes proteins. It’s considered a virulence factor and protects the bacteria from killing or digestion (e.g. phagocytosis by macrophages) and against desiccation.