server-side code for the pakt service