dev command starts a local development server that provides a live preview of your email templates in the browser with automatic hot reloading.
Usage
Options
Directory containing your email templates. The path is relative to your project root.
Port number for the development server.
Examples
Basic Usage
Start the dev server with default settings:http://localhost:3000 and watches the ./emails directory.
Custom Directory
Use a different directory for your email templates:Custom Port
Run the server on a different port:http://localhost:4000.
Combined Options
Combine multiple options:How It Works
When you runemail dev, the CLI:
- Validates that the specified email directory exists
- Starts a development server on the specified port
- Watches your email templates for changes
- Enables hot reloading to automatically refresh the preview when files change
- Serves static assets from the
staticsubdirectory (if it exists)
Hot Reloading
The dev server includes intelligent hot reloading that tracks dependencies:- Changes to email template files trigger automatic updates
- Changes to imported components or utilities are detected
- The browser preview refreshes instantly without losing state
Static Assets
You can include static assets like images in your emails:static directory.
Package Manager Support
The dev server works with npm, yarn, pnpm, and bun. It automatically detects your package manager.Troubleshooting
Port Already in Use
If port 3000 is already in use, specify a different port:Directory Not Found
If you see “Missing ./emails folder”, either:- Create the
emailsdirectory in your project root, or - Use
--dirto point to an existing directory:
Changes Not Reflecting
If hot reloading isn’t working:- Check the terminal for any errors
- Try manually refreshing the browser
- Restart the dev server with
Ctrl+Cand runemail devagain
Next Steps
Export Templates
Learn how to export your templates as static HTML
Build for Production
Build the preview app for production deployment