restructure code a bit to make more modular, add missing deps, add npm s...

i commented a bunch inline
the reason i didn't have all of this is in the same file is that i think that the route provider is going to get pretty long at some point, and separating route code with server initialization code seemed to make sense.