Skip to main content
When you run a web server, database, or API inside a sandbox, port forwarding lets you access it from your host machine as if it were running locally.

Expose a port

Start a service inside the sandbox and expose it to your host:
Omit host_port to let SmolVM pick an available port automatically:

Multiple ports

Expose multiple services from the same sandbox:

Remove a port forward

Port forwards are automatically cleaned up when the sandbox stops. To remove one manually:
expose_local() only binds to 127.0.0.1 (localhost). Services are not exposed to your network.

From the CLI

If you already have a running sandbox, you can forward ports from your terminal — no Python required:
CLI forwards are non-blocking and persist after the command exits. See smolvm sandbox port for the full reference.
Last modified on June 24, 2026