Serve Command

The smippo serve command starts a local web server to browse captured sites. It provides proper MIME types, directory listings, and automatic port detection.

Basic Usage

smippo serve [directory] [options]

Serve Default Directory

Serve the ./site directory (default output location):

smippo serve

Serve Custom Directory

Serve a specific directory:

smippo serve ./my-mirror
smippo serve ~/archives/docs-backup

Open in Browser

Automatically open the site in your default browser:

smippo serve ./site --open

Server Features

Auto Port Detection

If the default port (8080) is busy, Smippo automatically finds the next available port:

  ╭─────────────────────────────────────────────╮
  │                                             │
  │  Smippo Server                              │
  │                                             │
  │  Local:   http://127.0.0.1:8081             │
  │                                             │
  │  Serving: ./site                            │
  │                                             │
  │  Press Ctrl+C to stop                       │
  │                                             │
  ╰─────────────────────────────────────────────╯

Proper MIME Types

The server sets correct Content-Type headers for all file types:

  • HTML, CSS, JavaScript
  • Images (PNG, JPEG, GIF, WebP, SVG)
  • Fonts (WOFF, WOFF2, TTF, OTF)
  • Videos and audio
  • PDFs and archives
  • HAR files

Directory Browsing

When navigating to a directory without an index.html, Smippo displays a beautiful directory listing:

📦 Smippo
Captured Sites Browser

Home / example.com / about

📁 images      Directory
📁 css         Directory
📄 index.html  .html
📎 data.json   .json

CORS Support

CORS headers are enabled by default, allowing local development with cross-origin requests:

# CORS enabled (default)
smippo serve ./site

# Disable CORS
smippo serve ./site --no-cors

Port Configuration

Default Port

smippo serve ./site  # Uses port 8080

Custom Port

smippo serve ./site --port 3000
smippo serve ./site -p 3000

Host Binding

By default, the server binds to 127.0.0.1 (localhost only). To expose to the network:

# Bind to all interfaces
smippo serve ./site --host 0.0.0.0

# Bind to specific interface
smippo serve ./site --host 192.168.1.100

Request Logging

Verbose Mode

See all requests:

smippo serve ./site --verbose

Output:

  GET  200 / 5ms
  GET  200 /style.css 2ms
  GET  200 /logo.png 1ms
  GET  404 /favicon.ico 0ms

Quiet Mode

Minimal output (no request logging):

smippo serve ./site --quiet

Integration with Capture

Capture and Serve

# Capture a site
smippo https://example.com --depth 2

# Serve it immediately
smippo serve ./site --open

One-liner with npx

npx smippo serve ./site --open

Static Site Workflow

For best offline viewing, capture with --static and serve:

# Capture as static HTML (removes JS)
smippo https://spa-app.com --static --external-assets

# Serve the static version
smippo serve ./site --open

This creates a truly offline-viewable mirror without JavaScript dependencies.

Programmatic Usage

Start a server programmatically:

import { createServer } from 'smippo';

const server = await createServer({
  directory: './site',
  port: 8080,
  open: true,
});

console.log(`Server running at ${server.url}`);

// Later: stop the server
await server.close();

All Options

OptionDescriptionDefault
-p, --port <port>Port to serve on8080
-H, --host <host>Host to bind to127.0.0.1
-o, --openOpen browser automaticallyfalse
--no-corsDisable CORS headersCORS enabled
-v, --verboseShow all requestsfalse
-q, --quietMinimal outputfalse

Next Steps

Was this page helpful?