---
title: Getting started
description: Deploy a static build with wgw-deploy.
---

# Getting started

Build your project first, then run `wgw-deploy` from the project root.

```sh
npm run build
npx wgw-deploy
```

The default command resolves the project from the current working directory and deploys `dist`.

If your output directory has another name, pass it with `--dir`.

```sh
npx wgw-deploy --dir public
npx wgw-deploy --dir out
```

If you are running the command from outside the project, pass `--cwd`.

```sh
npx wgw-deploy --cwd /path/to/app --dir build
```

The CLI does not accept positional deploy paths. Use `--dir` for directories and files.

```sh
npx wgw-deploy --dir ./site/index.html
```

## Read the output

A successful deploy prints the project, revision, live URL, and pinned URL.

```txt
project   example-project
revision  abc123def4567890
live      https://example-project.wgw.lol/
pinned    https://example-project--abc123def4567890.wgw.lol/
```

Use the live URL when you want people to always see the latest deploy. Use the pinned URL when you need a link that keeps showing the same revision.

For machine-readable output, add `--json`.

```sh
npx wgw-deploy --json
```

The JSON output includes `projectSlug`, `productionUrl`, `revisionUrl`, `projectHash`, `revisionId`, `files`, `bytes`, and `uploadedAssets`.

## Re-deploy

Run the same command again after rebuilding.

```sh
npm run build
npx wgw-deploy
```

If the local files are unchanged and the local deploy cache is still fresh, the CLI reuses the current revision and reports a cached deploy. Otherwise it checks remote assets, uploads the missing assets, and finalizes a new revision.

## Assign a domain

Use `--domain` to assign a `wgw.lol` subdomain or a custom hostname to the locally tracked project.

```sh
npx wgw-deploy --domain preview.wgw.lol
npx wgw-deploy --domain preview.example.com
```

`--domain` is a domain operation. It creates or updates the project domain and then exits. Run `npx wgw-deploy` again if you also need to publish new files.

For a custom hostname, the CLI prints the CNAME record to create. For a `wgw.lol` subdomain, no external DNS record is needed.

Remove the assigned domain with:

```sh
npx wgw-deploy --delete-domain
```

## List and delete local projects

List locally tracked projects:

```sh
npx wgw-deploy --list
```

Delete the project matched by the current `--cwd` and `--dir`:

```sh
npx wgw-deploy --delete
```

`--delete` removes the local project state and asks the remote service to delete the project.
