What forms the base of the coral reef ecosystem?
One role of corals is to provide structure that offers protection from predation to many prey species as well as larvae and hatchlings. Reefs also provide relief from strong currents which, again, afford protection. Many other critters such as sponges, tunicates and other sessile animals use the reef as a substrate for attachment.

Don't be fooled by the apparent inedibility of coral, many fish eat it, notably Parrotfish. To give an idea of the extent of this activity, the bleached white beaches in Palau are carbonate "sand", not silica. They are the product of millenia of Parrotfish activity on the coral. (I don't have a link, this knowledge is courtesy of the Oceanic Society guide on our snorkeling trip.) In addition to Palau, I've snorkeled Indonesia, Honduras, Hawaii and elsewhere. In every venue, multitudes of many species of Parrotfish were to be seen aggressively chomping away at coral.

Also, the reef is also a substrate for many algae which serve as a food for other varietiesw of fish. Many of the coral inhabiting algae wouldn't be recognized as such looking like bubbles, fans and other oddities unlike common kelp.

Other species also feed on coral including welks, fireworms, nudibranchs and some starfish. Here's a link:http://infolific.com/pets/coral-reef-life/eating-the-coral-reef/