We present a first-principles approach to describe magnetic and superconducting systems and the phenomena of competition between these electronic effects. We develop a density functional theory: SpinSCDFT, by extending the Hohenberg-Kohn theorem and constructing the non-interacting Kohn- Sham system. An exchange-correlation functional for SpinSCDFT is derived from the Sham Schluter connection between the SpinSCDFT Kohn-Sham and a self-energy in Eliashberg approximation. The reference Eliashberg equations for superconductors in the presence of magnetism are also derived and discussed.