Skip to main content
Remix applications run natively on Node.js using the remix/node-fetch-server package to create HTTP servers compatible with the standard Fetch API.

Prerequisites

  • Node.js 25 or later
  • A Remix application ready to deploy

Server Setup

Create a production server entry point:
server.js
import { createServer } from 'remix/node-fetch-server'
import router from './router.js'

let port = process.env.PORT || 3000
let server = createServer(router)

server.listen(port, () => {
  console.log(`Server running on port ${port}`)
})

// Graceful shutdown
process.on('SIGTERM', () => {
  console.log('SIGTERM signal received: closing HTTP server')
  server.close(() => {
    console.log('HTTP server closed')
    process.exit(0)
  })
})

Build Process

Typically, you’ll compile your TypeScript code to JavaScript for production:
tsc -p tsconfig.json
Or use a bundler like esbuild for optimized builds:
esbuild src/server.ts --bundle --platform=node --outfile=dist/server.js

Environment Variables

Create a .env file for production configuration:
NODE_ENV=production
PORT=3000
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
SESSION_SECRET=your-secret-key-here

Process Management

Use a process manager like PM2 to keep your application running:
npm install -g pm2
pm2 start dist/server.js --name "remix-app"
pm2 save
pm2 startup

Deployment Options

VPS/Dedicated Server

  1. SSH into your server
  2. Clone your repository
  3. Install dependencies: npm install --production
  4. Build your application
  5. Start with PM2
  6. Configure nginx as a reverse proxy

Docker Container

Create a Dockerfile:
FROM node:25-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["node", "dist/server.js"]
Build and run:
docker build -t remix-app .
docker run -p 3000:3000 remix-app

Cloud Platforms

Railway, Render, Fly.io: These platforms auto-detect Node.js apps and typically require minimal configuration.

Reverse Proxy with Nginx

Configure nginx to proxy requests to your Node.js server:
server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Performance Optimization

  • Enable gzip compression with remix/compression-middleware
  • Use clustering to utilize multiple CPU cores
  • Implement caching strategies
  • Serve static files with nginx
  • Use a CDN for assets

Monitoring

Monitor your application with PM2:
pm2 monit
pm2 logs

Node Fetch Server

Complete API reference for the Node.js server

Performance Guide

Optimize your application for production

Build docs developers (and LLMs) love