  The Courant sigma model is a 3-dimensional topological sigma model of AKSZ
type which has been used for the systematic description of closed strings in
non-geometric flux backgrounds. In particular, the expression for the fluxes
and their Bianchi identities coincide with the local form of the axioms of a
Courant algebroid. On the other hand, the axioms of a Courant algebroid also
coincide with the conditions for gauge invariance of the Courant sigma model.
In this paper we embed this interplay between background fluxes of closed
strings, gauge (or more precisely BRST) symmetries of the Courant sigma model
and axioms of a Courant algebroid into an $L_\infty$-algebra structure. We show
how the complete BV-BRST formulation of the Courant sigma model is described in
terms of $L_\infty$-algebras. Moreover, the morphism between the
$L_\infty$-algebra for a Courant algebroid and the one for the corresponding
sigma model is constructed.
