If one is to look at a terrestrial ecosystem, the major parts are chemicals, bedrock, soil, plants and animals. The different types of ecosystems obviously have different major parts, a land-based ecosystem is going to look very different than one in the ocean, though the parts work together in very similar ways.
So if we look more closely at a particular ecosystem, the interactions between producers and consumers and decomposers becomes clear. For example, through photosynthesis, energy from the sun is turned into plant matter which is then consumed by various animals and insects. Then that same energy is transferred to other consumers and dropped in the form of droppings and mixed with dead and dying plants to be handled by the decomposers.
Then the decomposers work to break down the various products of the consumers into material useful to the plants as they get back to photosynthesis.