Buy detector frontend and backend code