That depends.
If app users with the ability to shut down the server or restart the server from the client app is appropriate for your case, have at.
I’ve never seen such a switch from a widely-available client app, though.
Usual is to have either a separate management app or tool or API or web interface, or to have the server itself or some related watchdog apps or hardware perform the shutdown or the restart, or a combination of these.
The webmin and cockpit tools might be interesting here, too.
For smaller servers, HomeKit Matter power switches can work, and for larger servers built-in management hardware (iLO, DRAC, IPMI, etc) or network-connected power switches can work.
Remote management can involve using a VPN or ssh connection into the server and the target network running the server, as well. And outages here can involve the remote firewall, the remote ISP, the server network, or the server itself.
Apple frowns on hidden features in apps too, so that switch would be exposed to all users of that app. If you trust all users to not poke the restart button whenever, have at.
If you want to see how server backends work, see NextCloud or Parse Platform, among many other fine choices.