Initial implementation of the database and api.