This first thing you need is water and sunlight, this is important for almost every ecosystem, including, to a certain degree, low light ecosystems such as caves. Secondly you require phototrophs, things that obtain energy directly from the sun, typically plant life. Secondly, other living organisms that feed off the phototrophs, and then organisms that feed off the herbivores.