  We connect the homotopy type of simplicial moduli spaces of algebraic
structures to the cohomology of their deformation complexes. Then we prove that
under several assumptions, mapping spaces of algebras over a monad in an
appropriate diagram category form affine stacks in the sense of Toen-Vezzosi's
homotopical algebraic geometry. This includes simplicial moduli spaces of
algebraic structures over a given object (for instance a cochain complex). When
these algebraic structures are parametrised by properads, the tangent complexes
give the known cohomology theory for such structures and there is an associated
obstruction theory for infinitesimal, higher order and formal deformations. The
methods are general enough to be adapted for more general kinds of algebraic
structures.
