I am not familiar with brew, but I suppose you mean the Homebrew software package management system for macOS.
Then the purpose of each system is:
- brew: installation of software, i.e. ready to consume applications like wget.
- npm: installation of packages (libraries), i.e. pieces of functionality to help you build your own applications.
- yarn: also installation of packages.
Yarn has some advantages over npm, the main two are the speed and the predictability. Yarn reuses the npm’s package.json file and doesn’t change its structure. Therefore you can run yarn install instead of npm install and theoretically everything will work automatically.
P.S. I agree, https://yarnpkg.com doesn’t have enough background on why the hell we need another package management system, but there is a great article which fills that gap.