[Unit]
Description=SkyArtShop Node.js Backend Server
Documentation=https://github.com/yourusername/skyartshop
After=network.target postgresql.service

[Service]
Type=simple
User=pts
WorkingDirectory=/media/pts/Website/SkyArtShop/backend
EnvironmentFile=/media/pts/Website/SkyArtShop/backend/.env
ExecStartPre=/media/pts/Website/SkyArtShop/pre-start.sh
ExecStart=/usr/bin/node /media/pts/Website/SkyArtShop/backend/server.js
Restart=always
RestartSec=10
StartLimitInterval=200
StartLimitBurst=5
StandardOutput=append:/var/log/skyartshop/output.log
StandardError=append:/var/log/skyartshop/error.log

# Restart service after 10 seconds if node service crashes
RestartSec=10
# Output to systemd journal for easy debugging
SyslogIdentifier=skyartshop

# Security settings
NoNewPrivileges=true
PrivateTmp=true

[Install]
WantedBy=multi-user.target
