To reduce it to its core, the foundation of ecological gardening is native plants. From native plants, native insects are drawn in, for the nectar and pollen, yes, but also because many of these insects rely on native plants as their food source in the larval stage of their lifecycle. Not all insects specialize in only one type of plant during the larval stage. Indeed, many are generalists that can use quite a variety of herbaceous plants, shrubs, or trees, which makes a lot of evolutionary sense. Why confine ones foraging habits to a single genus or species when a disease or some other calamity could wipe it out and thus wipe out your species in the process? Perhaps the most famous example of an insect species that does specialize in one genus of plants is the Monarch butterfly, a specialist of milkweeds in the Asclepias genus. Milkweeds do much more than just host Monarch caterpillars however. They attract a fantastically diverse group of insects for their nectar.
There is a bit more to ecological gardening in practice. Research by Douglas Tallamy has shown that it is important to ensure that a majority of plants (around 70%) in the garden are natives for the greatest beneficial impact on native insect populations.
A corollary to native planting and concern for insect populations is refraining from using pesticides, fungicides, or any other chemicals in the garden. In recent decades, neonicotinoids, a class of "systemic" pesticides absorbed into plants and present in all of their tissues, including nectar and pollen, have been widely used in order to control agricultural crop pests but have had the unintended side effect of harming bees, butterflies, and other important pollinators.
In terms of plant pests, it is often better to have a diverse set of native plants, which helps attract the natural predators that keep them in check. One of the best examples here is ladybugs, which are voracious hunters of aphids, soft-bodied insects that suck sap from plants and can weaken them.
Another important ecological gardening practice is to be less interventionist in the garden. In other words, do less, be lazier! Letting old stems from perennials remain in the garden, rather than cutting them down, creates more nesting sites for insects. Leaving leaves where they fall in the garden creates more habitat for young bumblebee queens to overwinter and helps a number of other species that similarly use the leaf litter. But one of the best parts of leaving leaves in place is soil health. We have noticed a real positive impact on our garden's soil health just from leaving leaves where they fall. An inch or two of leaves is great if your garden can handle it, but you don't necessarily want huge drifts of leaves a foot deep or more to develop. Too many leaves can prevent certain plants from breaking through the leaf litter, but most native wildflowers are vigorous enough to make their way through a light layer.