My RPi 3 B+ shuts down randomly. I have a official power supply and a 32 GB Toshiba microSDHC class 4 card. I'm using it as a host for a Discord bot.
Look at your logs in /var/logs using your preferred shell commands such as
pi@raspberrypi:~ $ less /var/log/syslog
You can also post that file or the end of it to a file hosting site and paste the link here.
Lastly, here are is some good raspberry pi troubleshooting information
As Dougie commented here, check your power supply. Not having required voltage caused my rpi to reboot often.