  Starting at the mesoscopic level with a general formulation of stochastic
thermodynamics in terms of Markov jump processes, we identify the scaling
conditions that ensure the emergence of a (typically nonlinear) deterministic
dynamics and an extensive thermodynamics at the macroscopic level. We then use
large deviations theory to build a macroscopic fluctuation theory around this
deterministic behavior, which we show preserves the fluctuation theorem. For
many systems (e.g. chemical reaction networks, electronic circuits, Potts
models), this theory does not coincide with Langevin-equation approaches
(obtained by adding Gaussian white noise to the deterministic dynamics) which,
if used, are thermodynamically inconsistent. Einstein-Onsager theory of
Gaussian fluctuations and irreversible thermodynamics are recovered at
equilibrium and close to it, respectively. Far from equilibirum, the free
energy is replaced by the dynamically generated quasi-potential (or
self-information) which is a Lyapunov function for the macroscopic dynamics.
Remarkably, thermodynamics connects the dissipation along deterministic and
escape trajectories to the Freidlin-Wentzell quasi-potential, thus constraining
the transition rates between attractors induced by rare fluctuations. A
coherent perspective on minimum and maximum entropy production principles is
also provided. For systems that admit a continuous-space limit, we derive a
nonequilibrium fluctuating field theory with its associated thermodynamics.
Finally, we coarse grain the macroscopic stochastic dynamics into a Markov jump
process describing transitions among deterministic attractors and formulate the
stochastic thermodynamics emerging from it.
