Refactor project generation to use dependency injection