Stochastic thermodynamics in many-particle systems