create factory and repo