Deploying a React or Next.js app
Developer Guides
This guide covers deploying React (static build) and Next.js (standalone server) to TransPark.
React (Static Build — e.g. Vite, CRA)
A React SPA compiles to static HTML/CSS/JS files. Use the Static HTML site type.
- Dashboard → Add Site → Select Static HTML
- Enter your domain → Create
- Build your React app locally:
npm run build - Upload the contents of your
dist/orbuild/folder to the document root via SFTP
That's it. Nginx serves the static files with proper caching headers and gzip.
Client-side routing: If you use React Router, you need a fallback rule. Create a file called .htaccess — wait, this is Nginx, not Apache. Instead, ask support to add this to your Nginx vhost:
try_files $uri $uri/ /index.html;
Next.js (Standalone Server)
Next.js with server-side rendering needs a Node.js site.
- Dashboard → Add Site → Select Node.js (port 3000)
- In your
next.config.js, enable standalone output:
module.exports = {
output: 'standalone',
};
- Build locally:
npm run build - Upload
.next/standalone/to the server via SFTP or Git - Also upload
.next/static/into.next/standalone/.next/static/ - Upload your
public/folder into.next/standalone/public/ - SSH in and start:
cd /home/[siteuser]/htdocs/[domain] pm2 start .next/standalone/server.js --name "nextjs-app" pm2 save
Next.js (Static Export)
If your Next.js app doesn't need SSR, you can export it as static:
// next.config.js
module.exports = { output: 'export' };
Then deploy like a regular React static build (see above).