Different biotic components in an ecosystem are connected through food and they are divided into three types based on how they obtain food:
Producers are photosynthetic organisms which are able to synthesise organic food from inorganic raw materials with the help of solar radiations through the process of photosynthesis, e.g., green plants, photosynthetic bacteria and some protists.
Consumers, including us, are the animals which are unable to synthesize their own food and utilize material and energy stored by the plants.
Primary consumers (herbivores) consume the producers.
Secondary consumers feed on the primary consumers. It includes carnivores.
Decomposers obtain their food molecules from the organic materials of dead producers (plants) and consumers (animals) and their waste products.