# on vercel

push mode, for hosts that can't run the runner

vercel can't run the runner, so it lives on another machine with a clone and pushes each change to github, which vercel builds like any push

## on the runner

```js title="computah.config.mjs"
import { gateway, vercel } from "@tetraslam13/computah/server";

export default {
  app: { install: "pnpm install --frozen-lockfile", build: "pnpm build" },
  identity: gateway(process.env.COMPUTAH_SECRET),
  trust: { owners: ["you@example.com"], members: "everyone" },
  release: { push: { branch: "main", host: vercel({ projectId: "prj_..." }) } }, // needs VERCEL_TOKEN
};
```

no `start` cause vercel serves the app. `gateway` means "believe the app's server about who's signed in when it sends the shared secret", and you run it with `computah serve` somewhere the app's server can reach

## in the app

one route passes the box's requests to the runner and says who's signed in:

```ts title="app/api/computah/[...path]/route.ts"
import { createProxy } from "@tetraslam13/computah/next";

export const { GET, POST } = createProxy({
  runner: process.env.COMPUTAH_RUNNER!,
  secret: process.env.COMPUTAH_SECRET!,
  identify: async (request) => {
    const user = await yourAuth(request);
    return user && { id: user.id, name: user.email };
  },
});
```

`yourAuth` is however your app knows who's signed in (`null` for nobody), and the box points at the route:

```tsx
<Computah endpoint="/api/computah" />
```

it only passes on changes from your own pages carrying the box's header, and it only uses standard `Request` and `Response` so any framework with those works

## what happens to a change

| | |
| --- | --- |
| owner or trusted | pushed to the branch vercel serves, and the box waits for the deploy and reloads |
| member | pushed to their own branch, `computah/u/` plus their name, and the box links vercel's preview as "open your version" |
| the build | checked on the runner before pushing (`check: false` skips that), and if vercel's fails anyway the end of its log goes to the agent like any [failed build](/how-a-change-travels) |
| someone pushed meanwhile | it merges their work and pushes again, once, and a conflict means the change doesn't go out |
| commit author | vercel refuses authors it can't match to the team, so commits use the runner machine's git email (make it someone on your team) and only the name is whoever asked |
| blocked deploy | reported in the box, not handed to the agent, cause code can't fix it |

## what you lose

it takes as long as vercel takes, and there's no live preview, so nobody gets to watch it happen :(

## another host

it's one function, `deployed({ sha, branch, production })`, that waits for the build and returns where it's served or throws with the build log for the agent to fix. more on [adapters](/adapters)

## how much it's been tested

i've run the vercel adapter against a real project with a scripted agent standing in: a production deploy, a member preview and a failed build that got fixed. the app-side route (`createProxy`) has only run in tests so far
