The dynamics of a many-body system coupled to an external environment represents a fundamentally important problem. To this class of open quantum systems pertains the study of energy transport and dissipation, dephasing, quantum measurement and quantum information theory, phase transitions driven by dissipative effects, etc. Here, we discuss in detail an extension of timedependent current-density-functional theory (TDCDFT), we named stochastic TDCDFT [Phys. Rev. Lett. 98, 226403 (2007)], that allows the description of such problems from a microscopic point of view. We discuss the assumptions of the theory, its relation to a density matrix formalism, and the limitations of the latter in the present context. In addition, we describe a numerically convenient way to solve the corresponding equations of motion, and apply this theory to the dynamics of a 1D gas of excited bosons confined in a harmonic potential and in contact with an external bath.