Generate packate tree (with self nodes) on server side.