Flexible backend

Started to prepare the code to plug in different back-ends.
Right now still mongo only but added some test which simulates the bootstrapping from the config with some mocks.