The main source of energy in an ecosystem is the sun. The sun's energy is capture by producers during photosynthesis. We can think of the sun's energy being trapped in the bonds of sugar molecules. Energy flows between organisms when one organism eats another. A food chain is a model that shows how matter and energy move through an ecosystem.
Food chains start with a producer, proceed to consumers and finally to decomposers.
Both nutrients and energy are passed from one level to the next. The various feeding levels in a food chain are called trophic levels . In a field grass is eaten by mice that are eaten by owls. This represents a food chain with 3 trophic levels. The number of trophic levels is limited because energy in the form of heat is lost at each transfer.