  In bulk samples and few layer flakes, the transition metal dichalcogenides
NbS$_2$ and NbSe$_2$ assume the H polytype structure with trigonal prismatic
coordination of the Nb atom. Recently, however, single and few layers of
1T-NbSe$_2$ with octahedral coordination around the transition metal ion were
synthesized. Motivated by these experiments and by using first-principles
calculations, we investigate the structural, electronic and dynamical
properties of single layer 1T-NbS$_2$. We find that single-layer 1T-NbS$_2$
undergoes a $\sqrt{13}\times\sqrt{13}$ star-of-David charge density wave.
Within the generalized gradient approximation, the weak interaction between the
stars leads to an ultraflat band at the Fermi level isolated from all other
bands. The spin-polarized generalized gradient approximation stabilizes a total
spin $1/2$ magnetic state with opening of a $0.15$ eV band gap and a
$0.21\mu_B$ magnetic moment localized on the central Nb in the star. Within
GGA+U, the magnetic moment on the central Nb is enhanced to $0.41\mu_{B}$ and a
larger gap occurs. Most important, this approximation gives a small energy
difference between the 1T and 1H polytypes (only $+0.5$ mRy/Nb), suggesting
that the 1T-polytype can be synthesized in a similar way as done for single
layer 1T-NbSe$_2$. Finally we compute first and second nearest neighbors
magnetic inter-star exchange interactions finding $J_1$=9.5~K and $J_2$=0.4~K
ferromagnetic coupling constants.
