dev command starts your Refine application in development mode with hot module replacement (HMR).
Usage
Options
Specify the platform to run the command on. The CLI auto-detects your project type, but you can override it.Choices:
vite, nextjs, remix, remix-spa, remix-vite, cracoStart Refine Devtools server alongside the dev server. Automatically enabled if devtools is installed.
Additional arguments passed directly to the underlying build tool (Vite, Next.js, etc.)
How It Works
Thedev command:
- Detects your project type (Vite, Next.js, Remix, etc.)
- Starts the Refine Devtools server (if installed)
- Runs the appropriate development command for your platform
- Enables hot module replacement for instant updates
Platform-Specific Commands
The CLI runs these commands based on your project type:- Vite:
vite dev - Next.js:
next dev - Remix:
remix dev - Craco:
craco start
Examples
Basic Usage
Start the development server:Output
Disable Devtools
Run without the Devtools server:Custom Port
Specify a custom port (passed to the underlying tool):Expose to Network
Make the dev server accessible on your local network:Output
Next.js with Turbopack
Use Next.js experimental Turbopack:Override Platform Detection
Force a specific platform:Devtools Integration
Refine Devtools provides:- Resource Inspector - View and manage your resources
- Network Monitor - Track API requests and responses
- Performance Metrics - Monitor your app’s performance
- Component Tree - Visualize your component hierarchy
http://localhost:5001 when running.
Environment Variables
The dev command sets these environment variables:REFINE_DEVTOOLS_PORT- Port for the Devtools server (default: 5001)- Platform-specific variables based on your project type
Common Use Cases
Development with HTTPS
For Vite projects:Open Browser Automatically
For Vite projects:Clear Cache on Restart
For Next.js projects:Development on Specific Network Interface
Package Manager Scripts
Add to yourpackage.json:
package.json
Troubleshooting
Port Already in Use
If port 5173 (or your default port) is occupied:Devtools Won’t Start
Check if Devtools is installed:HMR Not Working
If hot module replacement isn’t working:- Clear your build cache
- Restart the dev server
- Check for errors in the console
Slow Startup
For faster startup on large projects:- Disable Devtools:
refine dev --devtools false - Use Turbopack (Next.js):
refine dev --turbo - Optimize Vite config