build and cache client directory