They can be grouped into producers, consumers and decomposers.
Producers
Autotrophs in an ecosystem are called producers because they produce food for all other members of the ecosystem.
They are green plants, blue-green algae (Cyanobacteria), some bacteria and minute free-floating phytoplankton.
With the help of chlorophyll, carbon dioxide, water and utilizing the sun's energy, they synthesize organic food.
Consumers
Consumers consume food prepared by producers.
All animals including human beings are consumers.
They depend directly or indirectly on producers for food Consumers are also called heterotrophs.
They are put into three categories
Herbivores
They are animals that feed on plants.
Herbivores are also called primary consumers.
Carnivores
They are animals that prey upon herbivores (primary consumers) and eat their flesh.
Carnivores that eat herbivores are called primary carnivores or secondary consumers.
Omnivores
Animals that eat both plants as well animals are called omnivores.
Dogs, Human beings and Bears are omnivores.
Decomposers
Microorganisms (mostly bacteria and fungi) break down complex organic compounds from the bodies of dead animals, decaying remains of plants and faecal matter of animals into simple inorganic substances.