Topological insulators and superconductors are characterized by their gapless boundary modes. In this paper, we develop a recursive approach to the boundary Green function which encodes this nontrivial boundary physics. Our approach describes the various topologically trivial and nontrivial phases as fixed points of a recursion and provides direct access to the phase diagram, the localization properties of the edge modes, as well as topological indices. We illustrate our approach in the context of various familiar models such as the Su-Schrieffer-Heeger model, the Kitaev chain, and a model for a Chern insulator. We also show that the method provides an intuitive approach to understand recently introduced topological phases which exhibit gapless corner states.