add APIError and jsonapi
add timestamp in next_str()
add ORM support in db