Massive refactor of backend to use ActiveRecord and Modular Sinatra

Refactor the Sinatra backend to use a modular style to help separate the
backend and frontend parts of the application. ActiveRecord was used in
place of DataMapper so as to increase the options of using
authentication gems.