How to Deploy a Remix Application on a VPS
Remix is a full-stack React framework with server-side rendering and nested routing. Here is how to deploy a Remix application on your Breeze.
Prerequisites
# Install Node.js 20 LTS
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
sudo apt install -y nodejs
# Verify installation
node -v && npm -v
Build Your Remix App
cd /var/www/myremixapp
# Install dependencies and build
npm ci
npm run build
Create a Systemd Service
# /etc/systemd/system/remix-app.service
[Unit]
Description=Remix Application
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/myremixapp
ExecStart=/usr/bin/node node_modules/.bin/remix-serve build/server/index.js
Restart=on-failure
Environment=NODE_ENV=production
Environment=PORT=3000
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now remix-app
Reverse Proxy with Nginx
server {
listen 80;
server_name myremixapp.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Enable HTTPS with Certbot, then reload Nginx. Your Remix app is now live on your Breeze.