Magento 2 module to disable frontend
Disable the frontend in Magento 2 for using only the Admin and the API routes.
Install Disable Frontend for Magento2
composer require abelbm/magento2-disablefrontend
Stores > Configuration > Advanced > Admin > Disable Frontend