  Starting from a general material system of $N$ particles coupled to a cavity,
we use a coherent-state path integral formulation to produce a non-perturbative
effective theory for the material degrees of freedom. We tackle the effects of
image charges, the $A^2$ term and a multimode arbitrary-geometry cavity. The
resulting (non-local) action has the photonic degrees of freedom replaced by an
effective position-dependent interaction between the particles. In the
large-$N$ limit, we discuss how the theory can be cast into an effective
Hamiltonian where the cavity induced interactions are made explicit. The theory
is applicable, beyond cavity QED, to any system where bulk material is linearly
coupled to a diagonalizable bosonic bath. We highlight the differences of the
theory with other well-known methods and numerically study its finite-size
scaling on the Dicke model. Finally, we showcase its descriptive power with
three examples: photon condensation, the 2D free electron gas in a cavity and
the modification of magnetic interactions between molecular spins; recovering,
condensing and extending some recent results in the literature.
