Remix builds on web fundamentals: HTML forms, HTTP caching and progressive enhancement. Its nested routes load data in parallel on the server, so pages render quickly even before JavaScript arrives. Running Remix on a Hong Kong VPS keeps loaders next to your database and delivers responses to mainland China over CN2 GIA.
Step 1: Create the App and Build
npx create-remix@latest my-app
cd my-app
npm run build # outputs build/server and build/client
Step 2: Loader and Action Example
// app/routes/orders._index.tsx
import { json, type LoaderFunctionArgs, type ActionFunctionArgs } from '@remix-run/node'
import { useLoaderData, Form } from '@remix-run/react'
import { db } from '~/db.server'
export async function loader({ request }: LoaderFunctionArgs) {
const url = new URL(request.url)
const page = Number(url.searchParams.get('page') ?? 1)
const { rows } = await db.query(
'SELECT id, total, status FROM orders ORDER BY id DESC LIMIT 20 OFFSET $1',
[(page - 1) * 20])
return json({ orders: rows }, { headers: { 'Cache-Control': 'private, max-age=30' } })
}
export async function action({ request }: ActionFunctionArgs) {
const form = await request.formData()
await db.query('UPDATE orders SET status = $1 WHERE id = $2',
[form.get('status'), form.get('id')])
return json({ ok: true })
}
export default function Orders() {
const { orders } = useLoaderData<typeof loader>()
return (
<ul>
{orders.map(o => (
<li key={o.id}>#{o.id} - {o.status}
<Form method="post">
<input type="hidden" name="id" value={o.id} />
<button name="status" value="shipped">Ship</button>
</Form>
</li>
))}
</ul>
)
}
Step 3: Run with PM2
rsync -az --delete build package.json package-lock.json root@VPS_IP:/var/www/remix/
ssh root@VPS_IP "cd /var/www/remix && npm ci --omit=dev"
cat > /var/www/remix/ecosystem.config.cjs << 'EOF'
module.exports = { apps: [{
name: 'remix', script: 'node_modules/.bin/remix-serve', args: 'build/server/index.js',
cwd: '/var/www/remix', instances: 'max', exec_mode: 'cluster',
env: { NODE_ENV: 'production', PORT: 3000, DATABASE_URL: 'postgresql://app:pass@localhost/app' }
}]}
EOF
pm2 start /var/www/remix/ecosystem.config.cjs && pm2 save
Step 4: Nginx
upstream remix { server 127.0.0.1:3000; keepalive 32; }
server {
listen 443 ssl http2;
server_name app.example.com;
location /assets/ {
alias /var/www/remix/build/client/assets/;
expires 1y;
add_header Cache-Control "public, immutable";
}
location / {
proxy_pass http://remix;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Conclusion
Remix on a Hong Kong VPS pairs web-standard data loading with low-latency delivery to Greater China. Parallel loaders, HTTP caching headers and fingerprinted assets served by Nginx keep a 2 GB plan comfortable for typical production traffic.
Deploy Remix today: Browse Server.HK Hong Kong VPS plans.