@sharmmoh1983 There could be any number of things going on. You have an exercise in trying to narrow down the cause ahead of you.
As a test, disable MagicMirror from auto-starting, and just let your Pi run. If the restart still happens, then I’d say you either have a physical problem with the Raspberry Pi (again, check to ensure you’re using a good power supply - minimum 2.5 amps for the Pi 3 – when in doubt, order the official one), or maybe you have something else installed that is causing the issue.
If the restart is not observed without MM running, I might start with just the default config and run that for a while to see if the issue persists. If it doesn’t, then one of the modules you are using is likely the culprit, and you can try adding them back one by one until you see the problem again. Also be sure to check logs (
pm2 logs mm) to see if anything was captured before the Pi restarted.