It uses OpenStreetMap data plus a heavily customised instance of OSRM (Open Source Routing Machine, a fast routeplanning engine). The routing "profile", which calculates the weighting, is a few thousand lines of code alone, never mind various other stuff like custom elevation calculations.
It's a great project to work on, and the best reward of all is when people plan multi-day tours with it and say how much they've enjoyed the route.