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
One more step for FileVault-encrypted drives
Installr will prompt to erase the drive before installing macOS, but you installr won't see drives that are unmounted, so if the drive you're trying to reinstall macOS on is an encrypted drive, you'll either have to unlock/mount the drive first... or erase it first.
Once the drive is mounted, installr will recognize it (and prompt you to erase it again).
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 minute 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.
What the installr process looks like in Recovery Mode
To run installr, you might have to boot into Recovery Mode (especially on a T2 Mac), as opposed to running it from an external drive.
As I mentioned before, erasing the drive ahead of time isn't strictly necessary (it may be a FileVault-encrypted one), so if the drive is already mounted and isn't encrypted, you can skip launching Disk Utility.
If you did have to go through all that to erase the disk first, go ahead and Quit Disk Utility.
Once it's done, you should be at the start of Setup Assistant.