# FVTTT

CLI tool for tunneling a local [Foundry VTT](https://foundryvtt.com/) instance through a temporary [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/) (TryCloudflare).

Requires [Bun](https://bun.sh/).

## Install

```sh
bun install -g fvttt
```

Or run locally:

```sh
bun install
bun run fvttt
```

## Usage

1. Start Foundry VTT on your machine (default port `30000`).
2. Run `fvttt`.
3. Enter your Foundry port when prompted.
4. Copy the tunnel URL and share it with your players.
5. Press **Ctrl+C** to stop the tunnel when you're done.

The tunnel URL changes each time you run FVTTT.

## Foundry configuration

Foundry may reject requests from the tunnel hostname. If players see connection or host errors, add this to your Foundry `options.json` (via **Configuration → Edit Configuration** or by editing the file directly):

```json
{
  "options": {
    "hosts": true
  }
}
```

Setting `hosts` to `true` allows Foundry to accept connections from any hostname, which is required for ephemeral TryCloudflare URLs.

Alternatively, add the specific tunnel hostname to Foundry's allowed hosts if you prefer a narrower setting.

## How it works

On each run, FVTTT:

1. Ensures `cloudflared` is installed and up to date.
2. Prompts for your local Foundry port.
3. Starts a quick Cloudflare tunnel to `http://localhost:<port>`.
4. Prints the public URL and keeps the tunnel open until you stop it.

## License

MIT
