Answer explained
The components of an ecosystem are abiotic and biotic.
Abiotic components: physico-chemical factors — temperature, light, water, soil, and inorganic substances (C, N, O etc.) and organic compounds (proteins, lipids) present in the environment.
Biotic components (classified functionally): producers — autotrophs (green plants, cyanobacteria) that fix CO2 using light energy; consumers — heterotrophs depending on producers: primary consumers (herbivores), secondary consumers (carnivores feeding on herbivores), tertiary consumers (feeding on secondary consumers); decomposers (saprotrophs) — fungi and bacteria that break down the complex organic matter of dead organisms into simple inorganic substances, aiding nutrient cycling so producers can reuse them.