[Unit]
Description=zhixi NestJS API Server
After=network.target mysql.service redis.service
Wants=mysql.service redis.service

[Service]
Type=simple
User=ubuntu
Group=ubuntu
WorkingDirectory=/opt/zhixi/api-server
ExecStart=/usr/bin/node dist/src/main.js
Restart=always
RestartSec=5
TimeoutStopSec=30

# Environment
Environment=NODE_ENV=production
Environment=PORT=3000
EnvironmentFile=/opt/zhixi/env/.env.production

# Security
NoNewPrivileges=yes

# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=zhixi-nest-api

[Install]
WantedBy=multi-user.target
