We present a theory of superconducting p-n junctions. To this end, we consider a two band model of doped bulk semiconductors with attractive interactions between the charge carriers and derive the superconducting order parameter, the quasiparticle density of states and the chemical potential as a function of the semiconductor gap ∆0 and the doping level ε. We verify previous results for the quantum phase diagram for a system with constant density of states in the conduction and valence band, which show BCS-Superconductor to Bose-Einstein-Condensation (BEC) and BEC to Insulator transitions as function of doping level and the size of the band gap. Then, we extend this formalism to a density of states which is more realistic for 3D systems and derive the corresponding quantum phase diagram, where we find that a BEC phase can only exist for small band gaps ∆0 < ∆ * 0 . For larger band gaps, we find rather a direct transition from an insulator to a BCS phase. Next, we apply this theory to study the properties of superconducting p-n junctions. We derive the spatial variation of the superconducting order parameter along the p-n junction. As the potential difference across the junction leads to energy band bending, we find a spatial crossover between a BCS and BEC condensate, as the density of charge carriers changes across the p-n junction. For the 2D system, we find two possible regimes, when the bulk is in a BCS phase, a BCS-BEC-BCS junction with a single BEC layer in the space charge region, and a BCS-BEC-I-BEC-BCS junction with two layers of BEC condensates separated by an insulating layer. In 3D we find that there can also be a conventional BCS-I-BCS junction for semiconductors with band gaps exceeding ∆ * 0 . Thus, we find that there can be BEC layers in the well controlled setting of doped semiconductors, where the doping level can be varied to change and control the thickness of BEC and insulator layers, making Bose Einstein Condensates thereby possibly accessible to experimental transport and optical studies in solid state materials.PACS numbers: