# serve it

letting the runner serve the app itself

for an app people actually use every day, the runner serves the app itself. run this in the repo on a machine that stays on:

```sh
computah serve
```

it reads `computah.config.mjs` from the same folder:

```js title="computah.config.mjs"
export default {
  agent: "codex",
  app: {
    install: "pnpm install --frozen-lockfile",
    build: "pnpm build",
    start: "pnpm start", // must listen on $PORT
    dev: "pnpm dev", // optional: lets the person asking watch their change live
  },
  identity: "exe", // exe.dev's login, "local", or (request) => ({ id, name })
  trust: {
    owners: ["you@example.com"],
    trusted: ["friend@example.com"],
    members: "everyone",
    memberPaths: ["app/**"],
  },
};
```

## what the parts mean

| | |
| --- | --- |
| `agent` | `"claude"`, `"opencode"`, `"codex"` or [your own](/adapters). leave it out and it uses the first one installed |
| `app` | `install` runs once per fresh copy, `build` builds it and `start` serves it on `$PORT` (every copy gets a free one). in a monorepo, `dir: "apps/web"` says where the app is |
| `app.dev` | optional. with it, whoever asked watches the change happen on a hot-reloading copy, otherwise they see it once it's built |
| `identity` | who's visiting. `"exe"` reads [exe.dev's login](/on-exe-dev), `"local"` means this machine is you and nobody else counts, or write a function ([adapters](/adapters)) |
| `trust` | who can do what, on [people and trust](/people-and-trust) |

it listens on port 8000 on every interface (`port` and `host` in the config, or `--port`, change that), and opening it in a browser gets you your app with the box in it for the people you trust

## what it does when it starts

1. makes a branch `computah/main` from your current commit, which is everyone's version from then on
2. checks it out into `.computah/work/main`, so your own checkout never gets touched
3. installs, builds and starts it, then answers on its port

`/__computah` is the runner's (the box talks to it there) and every other path goes to the app. btw changes land on `computah/main`, not your branch, so you merge `computah/main` to get them

## the command

```sh
computah serve [--config computah.config.mjs] [--port 8000] [--cwd .]
```

`--config` is the file, `--port` overrides the config's port and `--cwd` is the repo. every field is on [reference](/reference)
