doom serve
Preview the production build of your documentation locally. Also available asdoom preview.
Usage
Arguments
Root directory of the documentation. Defaults to current working directory.
Options
Server host nameExample:
Server port numberExample:
Behavior
Prerequisites
You must rundoom build before using doom serve. The serve command looks for built files in the configured outDir.
Static File Server
The serve command starts a static file server that:- Serves pre-built HTML, CSS, and JavaScript
- Mimics production environment behavior
- Does not include hot reload or live updates
- Uses production optimizations and caching headers
Port Selection
The default port is4173. If the port is already in use, specify a different port with --port.
Examples
Basic usage
Custom port
Serve on all network interfaces
Serve specific directory
Serve with custom config
Using the preview alias
Output
When starting the server, you’ll see:Use Cases
Pre-deployment Testing
Test your production build before deploying:- All pages load correctly
- Navigation works as expected
- Assets are properly referenced
- Search functionality works
- Links are not broken
Sharing Local Builds
Share your build on local network:http://your-ip:8080
CI/CD Preview
Use in continuous integration to preview builds:Differences from Dev Server
| Feature | doom dev | doom serve |
|---|---|---|
| Hot Reload | Yes | No |
| Source Maps | Yes | No (production mode) |
| Compilation | On-demand | Pre-built |
| Optimizations | Minimal | Full |
| Speed | Slower initial | Instant |
| Use Case | Development | Testing/Preview |
Troubleshooting
Port already in use
Change the port:404 errors
Ensure you’ve built the project first:outDir contains built files.
Cannot access from network
Bind to all interfaces:Wrong base path
If routes are incorrect, rebuild with correct base:Related Commands
- doom build - Build for production
- doom dev - Development server
- doom export - Export to PDF