The growth of GaN layers was carried out on c-plane sapphire substrates by molecular beam epitaxy (MBE) using NH3. Undoped GaN layers were grown at 830 degrees C with growth rates larger than 1 mu m/h. Optical properties are characteristics of high quality GaN material and the linewidth of x-ray diffraction (0002) rocking curve is less than 350 arcsec. N-and p-type doping were achieved by using solid sources of Si and Mg. No post-growth annealing was needed to activate the Mg accepters. As-grown GaN:Mg layers exhibit hole concentrations of 3x10(17) cm(-3) and mobilities of 8 cm(2)/Vs at 300 K. Light emitting diodes (LEDs) based on GaN p-n homojunction have been processed. The turn on voltage is 3 V and the forward voltage is 3.7 V at 20 mA. The 300 K electroluminescence (EL) peaks at 390 nm.