Now that Mac imaging is essentially dead and the new T2 chips make it more complicated to boot from external drives, reinstalling macOS to re-deploy a Mac can be a bit trickier.
installr is a tool to do a clean reinstall of macOS via recovery mode (and install additional packages, too, if you'd like).
The actual usage of installr is fairly straightforward and explained well in its README on GitHub.
Here are a couple additional notes from my own testing on a late 2014 Mac Mini, though...
Listen to the README on http vs. https
https is definitely not something you can rely on if you're using installr over the network. If you try to serve up the installr.dmg over https, and then attach it via recovery mode, you may get this as a response:
hdiutil attach -help
installr from USB not that much faster than over network
Using installr over USB (even from a portable SSD) doesn't make the re-installation process go much faster.
When I ran installr of http (over wireless), it took 4 minutes and 27 seconds from confirming erasure of the drive to the installer finishing and then needing to reboot to complete the installation.
When I ran installr off a USB portable SSD, it took 1 minutes and 48 seconds from confirming erasure of the drive to the installer finishing and then needing to reboot to complete the installation.
So, it's a difference of less than 3 minutes. When you still have another 17 to complete the installation after that, 3 minutes is not a huge gain for choosing USB installr over http installr, but that small gain is something to consider when choosing how you decide to use installr in your own environment.
One huge advantage to using http is having the installr files or disk images in one place instead of a variety of USB drives. How you choose to use installr will greatly depend on the needs and means of your organization.