[Unit]
Description=Church Music Database Frontend (React Static Files)
Documentation=https://github.com/church-hop/music-database
After=network.target church-music-backend.service
Wants=church-music-backend.service

[Service]
Type=simple
User=pts
Group=pts
WorkingDirectory=/media/pts/Website/Church_HOP_MusicData/frontend/build
Environment="PATH=/usr/bin:/bin"
Environment="NODE_ENV=production"

# Security: Run with minimal privileges
NoNewPrivileges=true
PrivateTmp=true

# Start command using serve to host static files on port 5100
ExecStart=/usr/bin/serve \
    -s \
    -p 5100 \
    --no-clipboard \
    /media/pts/Website/Church_HOP_MusicData/frontend/build

# Restart policy
Restart=always
RestartSec=10
StartLimitInterval=300
StartLimitBurst=5

# Resource limits
MemoryMax=256M
CPUQuota=25%

# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=church-music-frontend

# Timeout settings
TimeoutStartSec=30
TimeoutStopSec=15

[Install]
WantedBy=multi-user.target
