The positron excess measured by PAMELA and AMS can only be explained if there is one or several sources injecting them. Moreover, at the highest energies, it requires the presence of nearby ($sim$hundreds of parsecs) and middle age (maximum of $sim$hundreds of kyr) source. Pulsars, as factories of electrons and positrons, are one of the proposed candidates to explain the origin of this excess. To calculate the contribution of these sources to the electron and positron flux at the Earth, we developed EDGE (Electron Diffusion and Gamma rays to the Earth), a code to treat diffusion of electrons and compute their diffusion from a central source with a flexible injection spectrum. We can derive the sources gamma-ray spectrum, spatial extension, the all-electron density in space and the electron and positron flux reaching the Earth. We present in this contribution the fundamentals of the code and study how different parameters affect the gamma-ray spectrum of a source and the electron flux measured at the Earth.