start command runs your built Refine application in production mode.
Usage
Before running
start, you must first build your application with refine build.Options
Specify the platform to run the start command on. The CLI auto-detects your project type, but you can override it.Choices:
vite, nextjs, remix, remix-spa, remix-vite, cracoAdditional arguments passed directly to the underlying server
How It Works
Thestart command:
- Detects your project type (Vite, Next.js, Remix, etc.)
- Runs the appropriate production server command
- Serves the built application from the output directory
Platform-Specific Commands
The CLI runs these commands based on your project type:- Vite:
vite preview - Next.js:
next start - Remix:
remix-serve build - Remix SPA:
vite preview
Examples
Basic Usage
Build and start your application:Output (Next.js)
Output (Vite)
Custom Port
Start on a specific port:Output
Expose to Network
Make the server accessible on your local network:Override Platform
Force a specific platform:Production Checklist
Before running in production:- Build your application:
refine build - Set environment variables
- Configure your reverse proxy (nginx, Apache)
- Set up SSL/TLS certificates
- Configure monitoring and logging
- Test all functionality
Environment Variables
Set production environment variables:Vite
.env.production
Next.js
.env.production
Package Manager Scripts
Add to yourpackage.json:
package.json
Deployment
Using PM2
Keep your app running with PM2:Using Docker
Create a Dockerfile:Dockerfile
Using systemd
Create a systemd service:/etc/systemd/system/refine-app.service
Reverse Proxy Configuration
nginx
/etc/nginx/sites-available/refine-app
Apache
/etc/apache2/sites-available/refine-app.conf
Platform-Specific Notes
Vite
- Uses
vite previewto serve the built files - Serves from
dist/directory - Not intended for production use - use a proper static file server or CDN
Next.js
- Runs a Node.js server for SSR and API routes
- Requires Node.js runtime in production
- Can use standalone output for smaller deployments
Remix
- Uses
remix-servefor full-stack Remix apps - Can deploy to edge runtimes (Cloudflare Workers, etc.)
- SPA mode uses Vite preview
Monitoring
Health Checks
Create a health check endpoint:src/pages/health.tsx
Logging
Capture logs for monitoring:Troubleshooting
Port Already in Use
Change the port:Build Directory Not Found
Ensure you’ve built the app first:Environment Variables Not Loading
Check your.env.production file and ensure variables are prefixed correctly:
- Vite:
VITE_* - Next.js:
NEXT_PUBLIC_*for client-side