  For an harmonic map $u$ from a domain $U\subset{\rm X}$ in an ${\sf
RCD}(K,N)$ space ${\rm X}$ to a ${\sf CAT}(0)$ space ${\rm Y}$ we prove the
Lipschitz estimate \[ {\rm Lip}(u|_B)\leq \frac {C(K^-R^2,N)}r\inf_{{\sf o}\in
{\rm Y}}\,\sqrt{\frac1{{\mathfrak m}(2B)}\int_{2B}{\sf d}_{\rm
Y}^2(u(\cdot),{\sf o})\, {\rm d}{\mathfrak m}}, \qquad \forall 2B\subset U \]
where $r\in(0,R)$ is the radius of $B$. This is obtained by combining classical
Moser's iteration, a Bochner-type inequality that we derive (guided by recent
works of Zhang-Zhu) together with a reverse Poincar\'e inequality that is also
established here. A direct consequence of our estimate is a Lioville-Yau type
theorem in the case $K=0$.
  Among the ingredients we develop for the proof, a variational principle valid
in general ${\sf RCD}$ spaces is particularly relevant. It can be roughly
stated as: if $({\rm X},{\sf d},{\mathfrak m})$ is ${\sf RCD}(K,\infty)$ and
$f\in C_b({\rm X})$ is so that $\Delta f\leq C$ for some constant $C>0$, then
for every $t>0$ and ${\mathfrak m}$-a.e.\ $x\in{\rm X}$ there is a unique
minimizer $F_t(x)$ for $ y\ \mapsto\ f(y)+\frac{{\sf d}^2(x,y)}{2t} $ and the
map $F_t$ satisfies \[ (F_t)_*{\mathfrak m}\leq e^{t(C+2K^-{\sf
Osc}(f))}{\mathfrak m},\qquad\text{where}\qquad {\sf Osc}(f):=\sup f-\inf f. \]
Here existence is in place without any sort of compactness assumption and
uniqueness should be intended in a sense analogue to that in place for Regular
Lagrangian Flows and Optimal Maps (and is related to both these concepts).
  Finally, we also obtain a Rademacher-type result for Lipschitz maps between
spaces as above.
