Skip to main content

doom serve

Preview the production build of your documentation locally. Also available as doom preview.

Usage

doom serve [root] [options]
doom preview [root] [options]

Arguments

root
string
Root directory of the documentation. Defaults to current working directory.

Options

-H, --host
string
Server host nameExample:
doom serve --host 0.0.0.0
-P, --port
string
default:"4173"
Server port numberExample:
doom serve --port 8080
See Global Options for additional options available to all commands.

Behavior

Prerequisites

You must run doom 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 is 4173. If the port is already in use, specify a different port with --port.

Examples

Basic usage

# Build first
doom build

# Then serve
doom serve

Custom port

doom serve --port 3000

Serve on all network interfaces

doom serve --host 0.0.0.0

Serve specific directory

doom serve ./my-docs

Serve with custom config

doom serve --config ./custom-config.yaml

Using the preview alias

doom preview --port 8080

Output

When starting the server, you’ll see:
info  Serving documentation...
  Local:   http://localhost:4173/
  Network: http://192.168.1.100:4173/

Use Cases

Pre-deployment Testing

Test your production build before deploying:
doom build
doom serve
Verify:
  • 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:
doom serve --host 0.0.0.0 --port 8080
Others on your network can access via: http://your-ip:8080

CI/CD Preview

Use in continuous integration to preview builds:
# Example GitHub Actions
- run: npm run build
- run: npm run serve &
- run: npm run test:e2e

Differences from Dev Server

Featuredoom devdoom serve
Hot ReloadYesNo
Source MapsYesNo (production mode)
CompilationOn-demandPre-built
OptimizationsMinimalFull
SpeedSlower initialInstant
Use CaseDevelopmentTesting/Preview

Troubleshooting

Port already in use

Change the port:
doom serve --port 4174

404 errors

Ensure you’ve built the project first:
doom build
Verify the outDir contains built files.

Cannot access from network

Bind to all interfaces:
doom serve --host 0.0.0.0
Check firewall settings if still inaccessible.

Wrong base path

If routes are incorrect, rebuild with correct base:
doom build --base /my-docs/
doom serve

Build docs developers (and LLMs) love