Domain walls in magnets, vortex lattices in superconductors, contact lines at depinning, and many other systems can be modelled as an elastic system subject to quenched disorder. Its field theory possesses a well-controlled perturbative expansion around its upper critical dimension. Contrary to standard field theory, the renormalization group flow involves a function, the disorder correlator $\Delta(w)$, therefore termed the functional renormalization group (FRG). $\Delta(w)$ is a physical observable, the auto-correlation function of the centre of mass of the elastic manifold. In this review, we give a pedagogical introduction into its phenomenology and techniques. This allows us to treat both equilibrium (statics), and depinning (dynamics). Building on these techniques, avalanche observables are accessible: distributions of size, duration, and velocity, as well as the spatial and temporal shape. Various equivalences between disordered elastic manifolds, and sandpile models exist: an elastic string driven at a point and the Oslo model; disordered elastic manifolds and Manna sandpiles; charge density waves and Abelian sandpiles or loop-erased random walks. Each of these mappings requires specific techniques, which we develop, including modelling of discrete stochastic systems via coarse-grained stochastic equations of motion, super-symmetry techniques, and cellular automata. Stronger than quadratic nearest-neighbour interactions lead to directed percolation, and non-linear surface growth with additional KPZ terms. On the other hand, KPZ without disorder can be mapped back to disordered elastic manifolds, either on the directed polymer for its steady state, or a single particle for its decay. Other topics covered are the relation between functional RG and replica symmetry breaking, and random field magnets. Emphasis is given to numerical and experimental tests of the theory.