Phase elements can improve the performance and reduce the size of imaging systems, thanks to the additional degrees of freedom that are offered by the independent phase gradient on top of a refractive/reflective surface. Possible implementations include diffractive elements or metasurfaces, but these suffer from diffractive dispersion. Similar optical functionality however can be provided by thin, curved Fresnel optics, which solely rely on refraction. In this study, a differentiable raytracing framework is presented that offers precise and rapid optimization of curved Fresnel surfaces, by modeling them as a combination of a distinct geometrical and refractive surface, both differentiable with respect to the imaging merit function. The method is demonstrated by designing a compact imaging and projection lens, both with high numerical aperture. The paper analyzes the impact of Fresnelizing the optimized "theoretical" surfaces on both the imaging performance and transmission efficiency. It furthermore shows how the system performance can be enhanced through dedicated post-processing steps, emphasizing the practical relevance of compact Fresnel optics.