# Run the binary

> Start the local server from the downloaded program, where it listens, where it keeps its files and how to stop it.

Source: https://stuarty.com/docs/self-hosting/binary/

## You will learn

- how to start and stop the server without a container;
- which address, workspace, key and log files it uses;
- how to check the installation before you rely on it.

## The idea

The release archive and the installers carry one program, `stuarty`. `stuarty serve` is the process that owns the [workspace](/docs/workspace): it serves the editor, the HTTP API and the MCP endpoint, and it runs the jobs. Without a container it runs in **local mode**: it listens on `127.0.0.1:7878` only, and a request needs the token in `<workspace>/token`. To serve other machines, use [network mode](/docs/self-hosting/network-mode), which has login and API keys.

The server makes no outbound connection by default and sends no telemetry; see [Privacy](/docs/self-hosting/privacy).

## Quick start

1. [Download and verify](/docs/self-hosting/verify-a-release) the archive of your platform, and put `stuarty` on your `PATH`.
2. Check the installation: `stuarty doctor --full` runs every check and names what to fix.
3. Start the server: `stuarty serve`. It stays in the foreground and logs to standard error.
4. Open the editor with `stuarty open`. It opens your browser on the local server, where you sign in with your local [account](/docs/account) (or create it on first start). To print the address for a tool such as Playwright without starting a browser, run `stuarty open` with `STUARTY_NO_BROWSER=1`. Opening `http://127.0.0.1:7878` directly redirects to the sign-in screen when no session cookie is present.

```bash
stuarty version
stuarty doctor --full
stuarty serve
```

Stop the server with `Ctrl+C` or by sending `SIGTERM`. It waits up to 15 seconds for running jobs to reach a safe point; a job that is still running then is interrupted and requeued, and the next start recovers it.

`stuarty open` starts a local server first when none runs, then opens the browser. When another process owns the workspace but does not answer yet (it is starting or busy), `open` never starts a second server: it waits up to 10 seconds for the owner, and then fails with `E_WORKSPACE_LOCKED` and exit code `2` ([the workspace is locked](/docs/troubleshooting/workspace-locked)). With `STUARTY_NO_BROWSER` set it prints the one-time link instead of starting a browser; open it once, it works for two minutes.

## What it uses

| Item | Where | Notes |
| --- | --- | --- |
| Workspace | `~/.stuarty`, or `STUARTY_HOME` | one directory; see [Workspace and storage](/docs/workspace) |
| Address | `127.0.0.1:7878`, or `STUARTY_ADDR` | an address that is not loopback is refused in local mode |
| Local token | `<workspace>/token` | readable only by you; `stuarty token:rotate` makes a new one |
| Application key | `<workspace>/app.key` | created on first start in local mode when `APP_KEY` is unset; keep it private |
| Logs | `<workspace>/logs/stuarty.log` | rotated at 10 MiB, three old files kept; `LOG_LEVEL` sets the level |
| FFmpeg | the order of [FFmpeg, codecs and licences](/docs/self-hosting/ffmpeg-and-licences): your setting, then the one next to `stuarty`, then the `PATH` | `STUARTY_FFMPEG` and `STUARTY_FFPROBE` name it explicitly; the release archives carry none |

Every variable is in the [configuration reference](/docs/reference/configuration).

## Common mistakes

- Starting a second `stuarty serve` on the same workspace: it fails with `E_WORKSPACE_LOCKED`. See [The workspace is locked](/docs/troubleshooting/workspace-locked).
- Binding another address in local mode. Set `STUARTY_MODE=network`, an `APP_KEY` and the rest of the network settings first.
- Putting the workspace inside a folder that a cloud-sync client manages: it can corrupt the database and the lock. `doctor --full` warns when it recognises such a folder.
- Deleting `app.key` or changing `APP_KEY` by accident: keep the key with your other secrets and back it up with the workspace.

## Next steps

- [Run the Docker image](/docs/self-hosting/docker)
- [Backups and upgrades](/docs/self-hosting/backups-and-upgrades)
