@vercel/board 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +25 -20
  2. package/dist/{access-CY5xVMIK.mjs → access-CdBcYPQH.mjs} +170 -13
  3. package/dist/access.d.mts +4 -5
  4. package/dist/access.mjs +5 -5
  5. package/dist/{actors-Bm-ojWWT.mjs → actors-MrIEr9LI.mjs} +3 -3
  6. package/dist/auth-DjoJygbG.mjs +599 -0
  7. package/dist/{auth-K8dY1nBY.d.mts → auth-aaoKt5DK.d.mts} +133 -100
  8. package/dist/backend-local.d.mts +28 -0
  9. package/dist/backend-local.mjs +2 -0
  10. package/dist/{backend-DxE9wGKm.d.mts → backend-u1sVvybh.d.mts} +108 -55
  11. package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
  12. package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-De0iDnUB.d.mts} +2 -3
  13. package/dist/cli-commands.d.mts +1 -1
  14. package/dist/cli-commands.mjs +1 -1
  15. package/dist/cli-embedded.d.mts +2 -2
  16. package/dist/cli-embedded.mjs +1 -1
  17. package/dist/cli.mjs +6 -6
  18. package/dist/{commands-DsnQKTdB.mjs → commands-B8oZEByR.mjs} +37 -52
  19. package/dist/{commands-CpyPV_tk.d.mts → commands-BkVMdXP1.d.mts} +9 -6
  20. package/dist/{conformance-3RBKxwbp.mjs → conformance-gqYBkXFS.mjs} +79 -86
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-DurYIRt8.mjs → engine-rtOVWsiF.mjs} +6 -8
  24. package/dist/{errors-CJXhhzvT.mjs → errors-D8ifv16L.mjs} +75 -6
  25. package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
  26. package/dist/exports-Bx2dGpzr.mjs +3252 -0
  27. package/dist/exports-uwRl5qIj.d.mts +4 -0
  28. package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
  29. package/dist/index-D6mK0Ial.d.mts +11 -0
  30. package/dist/index.d.mts +10 -9
  31. package/dist/index.mjs +21 -8
  32. package/dist/index.node.d.mts +6 -7
  33. package/dist/index.node.mjs +3 -3
  34. package/dist/inspect/app.js +95 -95
  35. package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
  36. package/dist/local-CPz22MQ8.mjs +9225 -0
  37. package/dist/{main-CcYDo9Hb.mjs → main-DScDKwQN.mjs} +129 -54
  38. package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
  39. package/dist/middleware-BjYpk4yq.mjs +103 -0
  40. package/dist/{provider-gynDUoyW.d.mts → provider-hB8QNrwm.d.mts} +369 -3
  41. package/dist/{client-COfYrgfV.d.mts → routes-De4W6lEs.d.mts} +997 -367
  42. package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
  43. package/dist/{serve-Bplieh0C.mjs → serve-B1noQRkn.mjs} +33 -24
  44. package/dist/{node-BgeGcwX0.mjs → server-Ov6GBJ8j.mjs} +419 -6
  45. package/dist/{serving-Y7s7VDjB.mjs → serving-2s7lqSBS.mjs} +1 -1
  46. package/dist/{sql-E1K5g_ih.mjs → sql-BQzKUqQt.mjs} +349 -114
  47. package/dist/sqlite-DCtZFEVm.mjs +30 -0
  48. package/dist/{sqlite-db-CzcD_FW8.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
  49. package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
  50. package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
  51. package/dist/store-memory-OdGsc-t_.mjs +2 -0
  52. package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
  53. package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
  54. package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
  55. package/dist/sync-chat-sdk.d.mts +2 -2
  56. package/dist/sync-chat-sdk.mjs +2 -2
  57. package/dist/sync-github.d.mts +2 -2
  58. package/dist/sync-github.mjs +2 -2
  59. package/dist/sync-linear.d.mts +3 -3
  60. package/dist/sync-linear.mjs +2 -2
  61. package/dist/sync-slack.d.mts +3 -3
  62. package/dist/sync-slack.mjs +4 -4
  63. package/dist/sync.d.mts +2 -2
  64. package/dist/sync.mjs +2 -2
  65. package/dist/{watchers-hash-CurCzwhe.mjs → targets-aMdbp84G.mjs} +134 -16
  66. package/dist/{tokens-C7kYyrAG.mjs → tokens-LHLrnV_P.mjs} +15 -43
  67. package/docs/01-board/01-mounting.md +245 -288
  68. package/docs/01-board/03-identity.md +42 -50
  69. package/docs/01-board/04-messages.md +15 -14
  70. package/docs/01-board/05-reading.md +3 -3
  71. package/docs/01-board/06-watchers.md +58 -105
  72. package/docs/01-board/07-schedules.md +21 -41
  73. package/docs/01-board/08-middleware.md +11 -17
  74. package/docs/01-board/09-access.md +187 -343
  75. package/docs/01-board/10-local.md +81 -0
  76. package/docs/01-quickstart.md +49 -126
  77. package/docs/02-sync/01-overview.md +25 -80
  78. package/docs/02-sync/02-functions.md +10 -16
  79. package/docs/02-sync/03-slack.md +13 -26
  80. package/docs/02-sync/04-github.md +8 -20
  81. package/docs/02-sync/07-linear.md +6 -10
  82. package/docs/03-guides/02-inspector.md +3 -3
  83. package/docs/03-guides/03-ci.md +88 -128
  84. package/docs/03-guides/04-triage.md +7 -15
  85. package/docs/03-guides/05-agent-factory.md +29 -36
  86. package/docs/04-reference/01-cli.md +113 -38
  87. package/docs/04-reference/02-board.md +79 -82
  88. package/docs/04-reference/03-http.md +138 -69
  89. package/docs/04-reference/05-conformance.md +32 -46
  90. package/docs/index.md +41 -65
  91. package/package.json +12 -83
  92. package/dist/a2-DiDc77Uf.mjs +0 -4238
  93. package/dist/access-DPcrKIH_.d.mts +0 -37
  94. package/dist/auth-8pRZnF1M.mjs +0 -393
  95. package/dist/backend-a2/blob-vercel.d.mts +0 -8
  96. package/dist/backend-a2/blob-vercel.mjs +0 -81
  97. package/dist/backend-a2/contract.d.mts +0 -828
  98. package/dist/backend-a2/contract.mjs +0 -5
  99. package/dist/backend-a2/scheduler-local.d.mts +0 -11
  100. package/dist/backend-a2/scheduler-local.mjs +0 -2
  101. package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
  102. package/dist/backend-a2/scheduler-qstash.mjs +0 -522
  103. package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
  104. package/dist/backend-a2/scheduler-vercel.mjs +0 -204
  105. package/dist/backend-a2/store-memory.d.mts +0 -11
  106. package/dist/backend-a2/store-postgres.d.mts +0 -38
  107. package/dist/backend-a2/store-postgres.mjs +0 -2977
  108. package/dist/backend-a2/store-redis-http.d.mts +0 -17
  109. package/dist/backend-a2/store-redis-http.mjs +0 -520
  110. package/dist/backend-a2/store-redis.d.mts +0 -31
  111. package/dist/backend-a2/store-redis.mjs +0 -88
  112. package/dist/backend-a2/store-sqlite.d.mts +0 -12
  113. package/dist/backend-a2/store-sqlite.mjs +0 -31
  114. package/dist/backend-a2.d.mts +0 -2633
  115. package/dist/backend-a2.mjs +0 -3
  116. package/dist/backend-http-CaN06CaD.d.mts +0 -672
  117. package/dist/backend-http-CoaCghuJ.mjs +0 -18
  118. package/dist/backend-http-l5A8UmL-.mjs +0 -585
  119. package/dist/backend-http.d.mts +0 -10
  120. package/dist/backend-http.mjs +0 -2
  121. package/dist/backend-http.node.d.mts +0 -10
  122. package/dist/backend-http.node.mjs +0 -2
  123. package/dist/backend-vercel-BE65okBC.mjs +0 -86
  124. package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
  125. package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
  126. package/dist/backend-vercel.d.mts +0 -9
  127. package/dist/backend-vercel.mjs +0 -11
  128. package/dist/backend-vercel.node.d.mts +0 -17
  129. package/dist/backend-vercel.node.mjs +0 -2
  130. package/dist/blob-Bx8QPWEd.d.mts +0 -40
  131. package/dist/blob-WbB2DJKn.mjs +0 -201
  132. package/dist/errors-2vGs49Db.d.mts +0 -16
  133. package/dist/exports-BnUZuRm9.mjs +0 -1389
  134. package/dist/exports-u5mApVvn.d.mts +0 -5
  135. package/dist/files-SniSmeEr.mjs +0 -47
  136. package/dist/folds-DLUzfibJ.d.mts +0 -558
  137. package/dist/folds-DsWfIftc.mjs +0 -208
  138. package/dist/index-UXpTPWNc.d.mts +0 -11
  139. package/dist/index.default-Dp8gexln.mjs +0 -12
  140. package/dist/local-C76Fy5ad.mjs +0 -44
  141. package/dist/middleware-BavYSDUa.mjs +0 -62
  142. package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
  143. package/dist/project-4Vl7_uy5.mjs +0 -124
  144. package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
  145. package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
  146. package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
  147. package/dist/reducers-DQVSP3kk.mjs +0 -538
  148. package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
  149. package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
  150. package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
  151. package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
  152. package/dist/server-wIpAEjpX.mjs +0 -17
  153. package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
  154. package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
  155. package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
  156. package/dist/store-memory-4IBl0Ztu.mjs +0 -2
  157. package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
  158. package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
  159. package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
  160. package/dist/targets-Cgjs29T0.mjs +0 -33
  161. package/dist/types-CmrFjpml.d.mts +0 -102
  162. package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
  163. package/docs/01-board/02-database.md +0 -258
  164. package/docs/04-reference/04-log.md +0 -247
  165. package/sql/postgres/board.sql +0 -145
  166. package/sql/postgres/notifications.sql +0 -24
  167. package/sql/postgres/schema.sql +0 -451
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Mounting
3
- description: "One `board()` call in one route, on a backend: `a2()` keeps the board in this deployment, `http()` uses another one, and any object that answers the protocol works. What it returns is the handle: it serves the board and acts on it."
3
+ description: "`board()` is your team's board in Vercel's API, or with `BOARD_URL` set, the board at that URL. With a backend it's any other: `local()` keeps one in this process, and any object that answers the protocol works. What it returns is the handle: it serves the board and acts on it."
4
4
  ---
5
5
 
6
6
  ## One route
@@ -11,25 +11,21 @@ npm i @vercel/board
11
11
 
12
12
  ```ts app/api/board/[[...path]]/route.ts
13
13
  import { board } from '@vercel/board'
14
- import { a2 } from '@vercel/board/backend-a2'
15
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
16
14
 
17
- export const team = board({ backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }) })
15
+ export const team = board()
18
16
  export const GET = team.fetch, POST = team.fetch
19
17
  ```
20
18
 
21
- That's a board. It answers at `/api/board`, and the CLI points at it with
22
- `BOARD_URL` or `--url`. `fetch` is its one handler; Next.js wants it under
23
- each method's name. `a2()` keeps the board in the store you give it, or in
24
- SQLite at `.a2/dev.db` without one, which a serverless function can't write:
25
- see [Without a store](#without-a-store). Call `board()` once, at module scope.
26
- A host that
27
- serves many teams' boards creates one per team instead, and caches them: see
28
- [A host's own verifier](./09-access.md#a-hosts-own-verifier).
19
+ That's your team's board, in Vercel's API. The board lives there, so this
20
+ deployment keeps nothing: people and the CLI use it in Vercel's API, and `vb`
21
+ finds it in any linked project. The route answers what Vercel's API sends this
22
+ deployment, the wake-ups that run its [watchers](./06-watchers.md), and serves
23
+ no other callers. `fetch` is its one handler; Next.js wants it under each
24
+ method's name. Call `board()` once, at module scope.
29
25
 
30
- A board is one log in one route of one Vercel project. The mount path is yours:
31
- the board infers it from requests. To get a second board (one the project's
32
- own people can't all read, say), mount a second route.
26
+ Code that only acts on the board needs no route: `board()` in a script or a
27
+ function is the same handle (see [The handle](#the-handle)). A team has boards
28
+ of its own, each with a name: see [A board by its name](#a-board-by-its-name).
33
29
 
34
30
  ## Backends
35
31
 
@@ -37,248 +33,151 @@ own people can't all read, say), mount a second route.
37
33
 
38
34
  | Backend | What it does |
39
35
  | --- | --- |
40
- | `a2({ store, … })` | Keeps the board in this deployment, on A2's log: its store, and a scheduler and attachments if you give them |
41
- | `http(url)` | Uses the board at `url`, which keeps the log. This project reads and writes it as itself |
36
+ | none | Your team's board in Vercel's API, the one `name` names. In Node with `BOARD_URL` set, the board at that URL instead: see [A handle on a board elsewhere](#a-handle-on-a-board-elsewhere) |
37
+ | `local()` | Keeps the board in this process, in SQLite under `.board/` or in memory: for development, `vb serve`, tests, and working offline. See [Local boards](./10-local.md) |
42
38
  | your own | Any object that answers the protocol: see [A backend of your own](#a-backend-of-your-own) |
43
39
 
44
40
  `board()` does the same on every backend. It routes and validates each
45
- request, verifies its caller, applies [`access`](./09-access.md), runs the
46
- [middleware](./08-middleware.md), and calls the backend's method for that
47
- route with the caller it verified and the parsed input. Who may use the board
41
+ request, verifies its caller, works out what it may do (see
42
+ [Access](./09-access.md)), runs the [middleware](./08-middleware.md), and
43
+ calls the backend's method for that route with the caller it verified and the
44
+ parsed input. Who may use the board
48
45
  and what its writes go through are `board()`'s, so the policy is in one place
49
46
  on any backend, and the backend stores. SSE, [the handle](#the-handle),
50
47
  [watchers](./06-watchers.md), and [sync](../02-sync/01-overview.md) are
51
48
  `board()`'s too.
52
49
 
53
- ```ts app/api/board/[[...path]]/route.ts
54
- import { board } from '@vercel/board'
55
- import { http } from '@vercel/board/backend-http'
56
-
57
- export const team = board({ backend: http('https://board.example.com/api/board') })
58
- export const GET = team.fetch, POST = team.fetch
59
- ```
60
-
61
- A board on `http()` keeps nothing:
62
-
63
- - **It answers only wake-ups and webhooks.** Anything else, discovery
64
- included, answers 404 `<its URL>
65
- answers only wake-ups and webhooks`, and verifies nothing. People and the
66
- CLI use the other board, by its URL. With an
67
- `access` of its own, it serves its callers too, as a gateway: see
68
- [A board on `http()`](./09-access.md#a-board-on-http).
69
- - **Its handle writes there as this deployment:**
70
- `vercel:project:prj_x:production`, and with `team.as('deploys')`,
71
- `vercel:project:prj_x:production+deploys`. Profiles start with a letter and
72
- use up to 32 letters, numbers, and hyphens. A post's `id` goes there as
73
- `key:<principal>:…`, which the other board takes only from that principal,
74
- so the same `id` never posts twice and no one can post with it first.
75
- - **Its watchers run here,** on what the other board matches for them, which
76
- wakes it when one matches: see [Watchers](./06-watchers.md#on-a-board-on-http).
77
- A wake-up carries no credential, so behind Deployment Protection this
78
- project lets `POST /wake` through itself, with a public production domain
79
- or a Deployment Protection Exception.
80
- - **Its sync runs here too.** Webhooks land on this board, and what it
81
- imports, it writes there. The other board must let this deployment `sync`
82
- in those channels: see [Sync on a board elsewhere](../02-sync/01-overview.md#on-a-board-elsewhere).
83
- - **The other board's policy holds there.** Its `authenticate` and `access`
84
- say what this deployment may do, and its [middleware](./08-middleware.md)
85
- sees what this one writes there. This board's own middleware sees it first.
50
+ ### Vercel's board
51
+
52
+ `board()` with no backend keeps nothing here:
53
+
54
+ - **Vercel's API keeps the board:** messages, threads, reactions, labels, a
55
+ channel's changes, schedules, and files, up to 100 MB each as a
56
+ [direct upload](../04-reference/03-http.md#direct-uploads).
57
+ - **Its watchers run here.** Vercel's API matches each event against their
58
+ tails and wakes this route when one matches: see
59
+ [Watchers](./06-watchers.md#woken-by-the-board).
60
+ - **It doesn't run sync yet.** `board({ sync })` throws when it's created: a
61
+ board with `sync` runs on [`local()`](./10-local.md), in a long-running
62
+ process.
63
+ - **It acts as this deployment, or as you.** In a Vercel deployment it sends
64
+ the deployment's OIDC token and writes as its project,
65
+ `vercel:project:prj_x:production`. Elsewhere it sends `VERCEL_TOKEN`, or
66
+ your Vercel CLI login, and writes as you. `fetch` sends other credentials.
67
+ - **What Vercel's API doesn't keep yet answers 501 `not_supported`:** files on
68
+ a scheduled message, labels on a scheduled reply, and a post's `sync`
69
+ targets. Grants and board tokens go to Vercel's API, which doesn't keep them
70
+ yet. A channel's message and thread counts are left out.
86
71
 
87
72
  A request's caller is who `board()` verified it is: `authenticate` checks its
88
73
  credential for the board's URL, which a token's audience must equal, works out
89
74
  the actor from its claims (the profile it writes as, its session, its scope),
90
- and `access` says what it may do. Nothing runs for a request before that.
75
+ and works out what it may do (see [Access](./09-access.md)). Nothing runs for
76
+ a request before that.
91
77
 
92
78
  ## Options
93
79
 
94
- `board()` takes the backend, who may use the board, and what runs here, on
95
- any backend:
80
+ `board()` takes the backend, who a request is, and what runs here, on any
81
+ backend:
96
82
 
97
83
  | Option | What it does |
98
84
  | --- | --- |
99
- | `backend` | `a2({ … })`, `http(url)`, or your own. Default `http()`: in Node, the board the environment points at, as [the handle](#a-handle-on-a-board-elsewhere) finds it |
100
- | `authenticate` | Who a request is. Default `oidcTokens()` from `@vercel/board/access`, which verifies its bearer token for the board's URL. Or a host's own verifier, `(request) => ({ id, kind, handle })`: see [A host's own verifier](./09-access.md#a-hosts-own-verifier) |
101
- | `access` | Who besides the board's people and its own environment's deployments may use it, and what each may do in each channel: `vercelProject()`, `githubActions()`, `oidc()` from `@vercel/board/access`, and functions of your own. Or a host's own function of the principal: see [Access](./09-access.md). On `http()`, it opens a gateway: none serves no requests |
85
+ | `backend` | `local()`, or your own. Default: your team's board in Vercel's API, the one `name` names, or in Node with `BOARD_URL` set, the board there, as [the handle](#a-handle-on-a-board-elsewhere) finds it |
86
+ | `fetch` | Without a `backend`: how requests reach Vercel's API, with credentials it takes. In Node it defaults to `VERCEL_TOKEN`, the deployment's OIDC token, then your `vercel login`. A board at `BOARD_URL` never gets it |
87
+ | `name` | Which of the team's boards this is, by its name: `security`. Default: the team's default board. See [A board by its name](#a-board-by-its-name) |
88
+ | `team` | Whose board this is: another team's, by its ID or slug, with `name` or without it for that team's default board. Default: the team the environment finds |
89
+ | `authenticate` | Who a request is. Default `oidcTokens()` from `@vercel/board/access`, which verifies its bearer token for the board's URL. Or a host's own verifier, `(request) => ({ id, kind, handle })`: see [Callers of your own](#callers-of-your-own) |
102
90
  | `middleware` | Runs on every post and edit before it reaches the backend, whatever it came from. See [Middleware](./08-middleware.md) |
103
- | `project` | `{ id, teamId? }`: the board's Vercel project, whose people its development tokens are, which discovery names. Defaults to `VERCEL_PROJECT_ID`, then `.vercel/project.json`. The team scopes `vercelProject()` rules named without one |
104
91
  | `watch` | Tails the board runs for you, keyed by id: `{ triage: { tail, run } }`. See [Watchers](./06-watchers.md) |
105
- | `sync` | Two-way sync, keyed by a name you choose: `{ slack: slack('slack/acme', channels({…})) }`. See [Sync](../02-sync/01-overview.md) |
92
+ | `sync` | Two-way sync, keyed by a name you choose: `{ slack: slack('slack/acme', channels({…})) }`. Not on Vercel's board yet. See [Sync](../02-sync/01-overview.md) |
106
93
  | `url` | The board's public URL, which every token's audience must equal. Inferred from requests otherwise |
107
94
  | `basePath` | The mount path, e.g. `/api/board`. Inferred from requests otherwise: a request can only make it look deeper than it is (`/api/board/x/messages/1`), so the board keeps the shallowest it's seen |
108
95
  | `streamMaxMs` | How long an SSE stream stays open before the board closes it and the client reconnects. Default `280000` |
109
96
 
110
- `a2()` takes what it keeps here, and what runs it. It reads nothing from the
111
- environment: a board is what you pass, the same in development, tests, and
112
- production.
113
-
114
- | Option | What it does |
115
- | --- | --- |
116
- | `store` | Where the board keeps its log and the tables it reads: `postgres()`, `redis()`, `redisHttp()`, `sqlite()`, or `memory()` from `@vercel/board/backend-a2/store-*`. See [Database](./02-database.md). Default: SQLite at `.a2/dev.db` in the working directory, everywhere. See [Without a store](#without-a-store) |
117
- | `scheduler` | The board's clock, for retries, leases, wake-ups, and scheduled messages: `vercelQueues()` from `@vercel/board/backend-a2/scheduler-vercel`, `qstash()` from `@vercel/board/backend-a2/scheduler-qstash`, or `localScheduler()` from `@vercel/board/backend-a2/scheduler-local`. See [Without a scheduler](#without-a-scheduler) |
118
- | `blob` | Where [attachments](./04-messages.md#attachments) live: `vercelBlob()` from `@vercel/board/backend-a2/blob-vercel`, with an optional `prefix` to share one store between boards, or `fsBlob(dir)` and `memoryBlob()` from `@vercel/board/backend-a2`. See [Without a blob store](#without-a-blob-store) |
119
-
120
- `http(url, { fetch })` takes the other board's URL, and how requests reach it
121
- with credentials it recognizes:
122
-
123
- | Option | What it does |
124
- | --- | --- |
125
- | `fetch` | How requests reach it, credentials included. In Node it defaults to what `vb` uses: a token whose audience is the other board's URL, from `BOARD_TOKEN`, `vb serve`'s, GitHub Actions, the Vercel runtime (a deployment's OIDC token), then `vercel login`, through Deployment Protection, with your handle (`BOARD_HANDLE`, then your Vercel username). In a browser it's `fetch`, sending the page's own session |
126
-
127
- In Node, `http()` without a `url` uses the board the environment points at:
128
- `BOARD_URL`.
97
+ `board()` knows its own Vercel project from `VERCEL_PROJECT_ID` on Vercel, or `.vercel/project.json` locally.
98
+ `local({ dir, memory })` takes where it keeps its files: see
99
+ [Local boards](./10-local.md#options).
129
100
 
130
101
  Set `url` when the board sits behind a proxy or rewrite that changes the
131
102
  origin it sees, so the audience it checks matches the one clients mint for.
132
103
  Clients then use that URL: a handle in Node mints for the URL it talks to, and
133
104
  refuses one whose discovery names another.
134
105
 
135
- ## A production board
136
-
137
- ```ts app/api/board/[[...path]]/route.ts
138
- import { board } from '@vercel/board'
139
- import { a2 } from '@vercel/board/backend-a2'
140
- import { vercelBlob } from '@vercel/board/backend-a2/blob-vercel'
141
- import { vercelQueues } from '@vercel/board/backend-a2/scheduler-vercel'
142
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
143
-
144
- // SSE streams close just before this, and clients reconnect where they left off.
145
- export const maxDuration = 300
146
-
147
- const backend = a2({
148
- store: postgres({ connectionString: process.env.DATABASE_URL! }),
149
- blob: vercelBlob(),
150
- scheduler: vercelQueues({ topic: 'board' }),
151
- })
152
-
153
- export const team = board({ backend })
154
- export const GET = team.fetch, POST = team.fetch
155
- export const { scheduler } = backend
156
- ```
157
-
158
- `postgres()` needs `pg` installed, and the board's tables applied to the
159
- database before the first deploy: see [Database](./02-database.md#postgres).
160
- `vercelQueues()` needs `@vercel/queue`. `vercelBlob()` needs `@vercel/blob` installed and a private Blob store
161
- connected to the project. It finds the store through `BLOB_READ_WRITE_TOKEN`,
162
- or the project's OIDC token and `BLOB_STORE_ID`.
163
-
164
- ## The scheduler route
165
-
166
- Mount the backend's `scheduler` as `POST` in a route of its own:
167
-
168
- ```ts app/api/a2/scheduler/route.ts
169
- export { scheduler as POST } from '@/app/api/board/[[...path]]/route'
170
- ```
171
-
172
- ```json vercel.json
173
- {
174
- "functions": {
175
- "app/api/a2/scheduler/route.ts": {
176
- "experimentalTriggers": [
177
- { "type": "queue/v2beta", "topic": "board", "retryAfterSeconds": 30 }
178
- ]
179
- }
180
- }
181
- }
182
- ```
183
-
184
- Keep it out of the board's catch-all route. A Vercel Queues trigger makes its
185
- function private, and the board's routes must stay public: people, CI, and
186
- platform webhooks all call them.
106
+ ## A board by its name
187
107
 
188
- The scheduler serves every A2 server behind the board: the log, sync's inbox,
189
- watchers, and schedules. To share one scheduler with A2 servers of your own,
190
- pass the same scheduler to `a2()` and to them, export the backend's `servers`
191
- from the board's route, and hand them to its handler yourself:
108
+ A team in Vercel has boards of its own, each with a name. `name` says which
109
+ one this is, `team` whose, on the board `board()` uses with no backend:
192
110
 
193
- ```ts lib/queue.ts
194
- import { vercelQueues } from '@vercel/board/backend-a2/scheduler-vercel'
195
-
196
- // One scheduler for the board and your own A2 servers.
197
- export const queue = vercelQueues({ topic: 'board' })
198
- ```
199
-
200
- ```ts app/api/board/[[...path]]/route.ts
111
+ ```ts lib/board.ts
201
112
  import { board } from '@vercel/board'
202
- import { a2 } from '@vercel/board/backend-a2'
203
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
204
- import { queue } from '@/lib/queue'
205
-
206
- const backend = a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }), scheduler: queue })
207
113
 
208
- export const team = board({ backend })
209
- export const GET = team.fetch, POST = team.fetch
210
- export const { servers } = backend
114
+ export const security = board({ name: 'security' })
115
+ export const acme = board({ team: 'acme', name: 'security' })
116
+ export const acmeGeneral = board({ team: 'acme' })
211
117
  ```
212
118
 
213
- ```ts app/api/a2/scheduler/route.ts
214
- import { queue } from '@/lib/queue'
215
- import { servers } from '@/app/api/board/[[...path]]/route'
216
- // import { ordersServer } from '@/server/orders' // yours, created with the same queue
217
-
218
- export const POST = queue.handler(...servers /*, ordersServer */)
219
- ```
119
+ - **`name` is one of the team's boards, and `team` another team's.** Without
120
+ a name, it's the team's default board, named General, so `general` finds it
121
+ too. A name matches whatever its case.
122
+ - **A name is 1 to 64 characters with no `/`,** and `team` is a team's ID
123
+ (`team_…`) or its slug. `board()` throws on either that isn't. Without
124
+ `team`, it's the team the environment finds: in Node, the deployment's,
125
+ `VERCEL_ORG_ID`, or the linked project's.
126
+ - **`board({ name })` makes the board** the first time anyone uses a name the
127
+ team has none for: this project's own code, and a person too (`next dev`
128
+ with a login, a script). Vercel's API grants a project's new board to that
129
+ project, in the environment it runs in, and anyone on the team can use it.
130
+ - **`ensure: false` only finds one.** A name the team has none for fails with
131
+ 404 `no_board`, `no board named security on this team, or none you can see.`
132
+ - **`vb` makes one only with `--ensure`,** so a typo at a terminal makes no
133
+ board. Without it, `vb` fails with that 404, and its way out is the same
134
+ command with `--ensure`.
135
+ - **Names are unique across the team's boards,** private ones included. One a
136
+ board you can't see has fails with 409 `board_name_taken`,
137
+ `the board name vault is taken.`, and makes nothing: pick another name, or
138
+ ask whoever can see it for access.
139
+ - **A board this project has no access to** fails with 403
140
+ `board_not_granted`,
141
+ `this project has no access to board security (prj_pong, preview).` Every
142
+ project on the team gets in unless the board's grants were narrowed, so
143
+ someone who manages the board grants it. The team's default board says the
144
+ same.
145
+
146
+ The backend reads them once, when `board()` binds it: `binding.name`, null for
147
+ the team's default board, `binding.team`, null for the environment's team, and
148
+ `binding.ensure`. `board({ ensure: true })` without a `name` throws. With
149
+ `BOARD_URL` set, the board is the one at that URL, whatever the name, and
150
+ `local()` keeps a file per name: see [Local boards](./10-local.md).
151
+
152
+ ## On Vercel
153
+
154
+ A route on your team's board needs little:
155
+
156
+ - **The board granted to the project.** Someone on the team grants it the
157
+ team's default board, in each environment that uses it: until then, the
158
+ project's code fails with 404 `no_board`. A named board the team doesn't
159
+ have yet, the project's own code makes, granted to it; one the team has
160
+ answers 403 `board_not_granted` until someone grants it.
161
+ - **The route, for watchers.** From production, or a preview of a branch,
162
+ Vercel's API wakes it by its path on this project, through Deployment
163
+ Protection, with nothing to set up. Anywhere else it registers its URL, or
164
+ pulls on its own without an `https` one.
220
165
 
221
166
  ## A dev server
222
167
 
223
168
  ```ts app/api/board/[[...path]]/route.ts
224
169
  import { board } from '@vercel/board'
225
- import { a2, fsBlob } from '@vercel/board/backend-a2'
226
- import { localScheduler } from '@vercel/board/backend-a2/scheduler-local'
170
+ import { local } from '@vercel/board/backend-local'
227
171
 
228
- // SQLite at .a2/dev.db, files in .a2/attachments, and timers in this process.
229
- export const team = board({ backend: a2({ scheduler: localScheduler(), blob: fsBlob() }) })
172
+ // SQLite at .board/local.db, files in .board/local/, and timers in this process.
173
+ export const team = board({ backend: local() })
230
174
  export const GET = team.fetch, POST = team.fetch
231
175
  ```
232
176
 
233
- `localScheduler()` keeps its timers in the process, and a restart drops the
234
- pending ones. It's for development, `vb serve`, tests, and long-running
235
- servers, never serverless functions, which stop between requests: there, use
236
- `vercelQueues()` or `qstash()`. `vb serve` runs this setup under `.board`.
237
-
238
- ## Without a store
239
-
240
- A board on `a2()` with no `store` keeps its log and tables in SQLite at
241
- `.a2/dev.db`, relative to the working directory, in every environment. A file
242
- on disk suits development and a single long-running server, and survives
243
- restarts.
244
-
245
- A serverless function can't write there: a Vercel deployment's files are
246
- read-only outside `/tmp`. Every request to such a board answers 500
247
- `no_store`, ``can't open SQLite at .a2/dev.db: this filesystem isn't writable here, so pass a store to a2()``,
248
- and nothing stands in for it in memory. Pass `postgres()`, `redis()`, or
249
- `redisHttp()` there. Don't point `sqlite({ path })` at `/tmp`: each instance
250
- would keep a board of its own, gone when the instance is.
251
-
252
- ## Without a scheduler
253
-
254
- A board on `a2()` with no `scheduler` still runs everything that follows a
255
- write: the tables it reads, [watchers](./06-watchers.md), and
256
- [sync](../02-sync/01-overview.md)'s deliveries and imports run in the request
257
- that wrote, as A2's consumers. What needs a clock works like this:
258
-
259
- - **Scheduling refuses.** `POST /schedules`, `schedule()`, and `vb schedule`
260
- answer 501 `no_scheduler`:
261
- ``this board has no scheduler: pass `scheduler` to `a2()` to send later``.
262
- `vb conformance` reports the schedules check as not kept here.
263
- - **A failure waits for the next write.** A watcher run or a delivery that
264
- throws is tried again when the next event reaches it, not on a clock, and
265
- reads never wake it.
266
- - **So does what runs out.** A pulled match whose lease ran out goes to the
267
- next pull, and a board on `http()` that a wake-up didn't reach is woken by
268
- the next match after its wait.
269
-
270
- That suits a tool or a script's own board. A production board with watchers or
271
- sync takes a scheduler, so a failure is retried on a clock and nothing waits
272
- for traffic.
273
-
274
- ## Without a blob store
275
-
276
- A board on `a2()` with no `blob` keeps no files. `POST /attachments`, a post,
277
- schedule, or import that carries `attachments`, and a download answer 501
278
- `no_files`: ``this board keeps no files: pass `blob` to `a2()` ``. Sync brings a
279
- platform's files over as links to where they live, one line each, and the rest
280
- of the board works. `vb conformance` reports the attachments check as not kept
281
- here.
177
+ `local()` keeps its timers in the process, and a restart drops the pending
178
+ ones. It's for development, `vb serve`, tests, and working offline, never
179
+ serverless functions, which stop between requests. `vb serve` runs it under
180
+ `.board`. See [Local boards](./10-local.md).
282
181
 
283
182
  ## The handle
284
183
 
@@ -303,13 +202,17 @@ export async function POST(request: Request) {
303
202
  | `post`, `reply`, `messages`, … | What the board's caller can do: see the [handle reference](../04-reference/02-board.md) |
304
203
  | `as(profile)` | The handle, acting with that profile |
305
204
 
306
- - **On `a2()`, it's the board's own code,** in-process, with no URL or token.
307
- It writes as `board:client`, and `team.as('deploys')` as
308
- `board:client:deploys`, with the profile as its handle. Profiles use
205
+ - **On Vercel's board, it's this deployment,** with its OIDC token: it writes
206
+ as `vercel:project:prj_x:production`, and `team.as('deploys')` as
207
+ `vercel:project:prj_x:production+deploys`. Profiles start with a letter and
208
+ use up to 32 letters, numbers, and hyphens.
209
+ - **With `BOARD_URL` set, it's whoever its credentials say:** see
210
+ [A handle on a board elsewhere](#a-handle-on-a-board-elsewhere).
211
+ - **On `local()`, it's the board's own code,** in-process, with no URL or
212
+ token. It writes as `board:client`, and `team.as('deploys')` as
213
+ `board:client:deploys`, with the profile as its handle. Profiles there use
309
214
  lowercase letters, numbers, `-`, and `_`, and one that doesn't fails its
310
215
  first call.
311
- - **On `http()`, it's the token's holder,** this deployment: see
312
- [A handle on a board elsewhere](#a-handle-on-a-board-elsewhere).
313
216
  - **A post's `id` makes it idempotent.** The same `id` from the same handle
314
217
  never posts twice, so a redelivered webhook does nothing: use the delivery's
315
218
  own ID. The `id` is the handle's own: another profile's post with it is
@@ -318,15 +221,13 @@ export async function POST(request: Request) {
318
221
  [middleware](./08-middleware.md) and wake [watchers](./06-watchers.md) and
319
222
  [sync](../02-sync/01-overview.md) like anyone's.
320
223
 
321
- The backend keeps its own: `a2()`'s has `scheduler`, the scheduler's callback
322
- for [its own route](#the-scheduler-route), which answers 404 on a board without
323
- one, and `servers`, its A2 servers, for a shared scheduler. `http()`'s has
324
- `registerWatchers()`, which registers its watchers there now, as `POST /watchers`
325
- does.
224
+ `POST /watchers` on the route registers its watchers with the board now, and
225
+ `local()`'s backend has `close()`, which closes its file.
326
226
 
327
227
  ## A handle on a board elsewhere
328
228
 
329
- `board()` with no backend is `http()` to the board the environment points at:
229
+ `board()` with no backend is your team's board in Vercel's API, the one `name`
230
+ names (see [A board by its name](#a-board-by-its-name)):
330
231
 
331
232
  ```ts scripts/report.ts
332
233
  import { board } from '@vercel/board'
@@ -335,43 +236,40 @@ const team = board()
335
236
  await team.post('deploys', 'www@a1b2c3 is live')
336
237
  ```
337
238
 
338
- In Node it finds that board in `BOARD_URL`, as `vb` does. It acts as whoever its `fetch`'s
339
- credentials say, and the default one sends a token from `BOARD_TOKEN`, a local
340
- board's token file (`vb serve`), GitHub Actions OIDC, Vercel OIDC, then your
341
- `vercel login`. Its profile is `BOARD_AS`, or the coding agent it runs in,
342
- with that agent's session; `team.as(null)` acts as yourself. The
343
- [CLI](../04-reference/01-cli.md#configuration) works the same way, because it's
344
- this handle.
345
-
346
- Its calls go through `board()` like any handle's: `board()` runs its
347
- middleware and calls `http()`'s methods, and they call the other board, whose
348
- middleware sees its posts too.
349
-
350
- `@vercel/board` and `@vercel/board/backend-http` have two builds each, picked by export
351
- condition: the `node` one finds boards and credentials as above, and the
352
- default one, for browsers, finds none in the environment; the rest runs the
353
- same. There, `fetch` sends the page's own session to a board on the same
354
- site:
239
+ In Node it finds the team and credentials as the Vercel CLI and a deployment
240
+ do. The team is `VERCEL_ORG_ID`, the deployment's, or the nearest
241
+ `.vercel/project.json`'s, unless `team` says another (`acme`). The
242
+ credentials are `VERCEL_TOKEN`, the deployment's OIDC token, then your
243
+ `vercel login`, or what `fetch` sends: a deployment writes as its project, and
244
+ you as yourself. Its profile is `BOARD_AS`, or the coding agent it runs in,
245
+ with that agent's session; `team.as(null)` acts as yourself.
355
246
 
356
- ```tsx app/board.tsx
357
- 'use client'
358
- import { board } from '@vercel/board'
359
- import { http } from '@vercel/board/backend-http'
247
+ With `BOARD_URL` set, it's the board at that URL instead, whatever the name:
248
+ a board `vb serve` runs, say:
360
249
 
361
- // On the board's own site, so the page's session cookie goes with each request.
362
- const team = board({
363
- backend: http('https://www.example.com/api/board', {
364
- fetch: (input, init) => fetch(input, { ...init, credentials: 'same-origin' }),
365
- }),
366
- })
250
+ ```bash
251
+ # in a terminal: vb serve prints the URL that reaches it
252
+ BOARD_URL=http://127.0.0.1:4100/api/board node scripts/report.ts
367
253
  ```
368
254
 
369
- The board recognizes that session with `board({ authenticate })`: the app's own
370
- verifier reads the cookie in the request's headers, and composes with
371
- `oidcTokens()`, so `vb` and deployments still get in with their tokens. Its
372
- route checks the `Origin` of every write, since a browser sends the cookie with
373
- other sites' requests too: see [A host's own verifier](./09-access.md#a-hosts-own-verifier).
374
- Never hand a browser a token of the deployment's: it would act as the
255
+ It acts as whoever its credentials say, and the default ones are a token from
256
+ `BOARD_TOKEN`, a local board's token file (`vb serve`), GitHub Actions OIDC,
257
+ Vercel OIDC, then your `vercel login`, made out to that URL, through
258
+ Deployment Protection. `fetch` doesn't go there: credentials for Vercel's API
259
+ never reach another host. The [CLI](../04-reference/01-cli.md#configuration)
260
+ works the same way, because it's this handle.
261
+
262
+ Its calls go through `board()` like any handle's: `board()` runs its
263
+ middleware and calls the backend's methods, which call the board at
264
+ `BOARD_URL`, whose middleware sees its posts too.
265
+
266
+ `@vercel/board` has two builds, picked by export condition: the `node` one
267
+ finds boards and credentials as above, and the default one, for browsers,
268
+ finds none in the environment; the rest runs the same. There,
269
+ `board({ team, name, fetch })` reaches Vercel's board with what `fetch` sends:
270
+ credentials Vercel's API takes. Nothing in a browser finds a team, so it's
271
+ `team`'s, or with none, the token's own team. Never hand a browser a token of
272
+ the deployment's: it would act as the
375
273
  deployment for anyone who reads it.
376
274
 
377
275
  ## A backend of your own
@@ -387,12 +285,11 @@ The shortest one is another backend with a method changed:
387
285
 
388
286
  ```ts app/api/board/[[...path]]/route.ts
389
287
  import { board, HttpError, type Backend } from '@vercel/board'
390
- import { a2 } from '@vercel/board/backend-a2'
391
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
288
+ import { local } from '@vercel/board/backend-local'
392
289
 
393
- const kept = a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) })
290
+ const kept = local()
394
291
 
395
- // a2()'s board, except that its messages are never deleted.
292
+ // local()'s board, except that its messages are never deleted.
396
293
  const backend: Backend = {
397
294
  ...kept,
398
295
  async delete() {
@@ -402,7 +299,6 @@ const backend: Backend = {
402
299
 
403
300
  export const team = board({ backend })
404
301
  export const GET = team.fetch, POST = team.fetch
405
- export const { scheduler } = kept
406
302
  ```
407
303
 
408
304
  What a backend has:
@@ -411,8 +307,9 @@ What a backend has:
411
307
  | --- | --- |
412
308
  | `discovery`, `me`, `messages`, `post`, … | One method per protocol route, `(caller, input, signal)`, named for it: the [HTTP reference](../04-reference/03-http.md#routes) lists them, and the `Protocol` type from `@vercel/board` says what each takes and answers |
413
309
  | `routes` | Routes of its own beside the protocol: `{ method, path, handle(request, { caller, param }) }`. One at a protocol route's path takes its place. `board()` verifies nothing for them: `caller` is null for a request, or the handle's own when its call reaches one |
414
- | `keeps` | Whether the board lives here. `true` lets the board's people and own deployments in when `access` is left out; `false`, as on `http()`, serves no requests then but wake-ups and webhooks |
415
- | `bind(binding)` | Called once, when `board()` is created, before any request. It does no I/O |
310
+ | `keeps` | Whether the board lives here. `true` serves its callers: the board's people, its own deployments, and whoever grants and board tokens let in. `false`, as on Vercel's board and the board at `BOARD_URL`, serves no requests but wake-ups and webhooks |
311
+ | `trust` | Its [grants](./09-access.md#grants) and [board tokens](./09-access.md#tokens), for a backend that keeps them: `grants()`, `token(hash)`, and `live(id)`. `board()` checks each request against them as they are then. Without it, they let no one in |
312
+ | `bind(binding)` | Called once, when `board()` is created, before any request. It does no I/O. `binding.name` and `binding.team` are `board({ name, team })`'s, or null |
416
313
 
417
314
  - **A caller is one `board()` verified, or its own code.** `{ identity, origin }`
418
315
  is a request's, or for work the backend does outside requests, the one it
@@ -451,6 +348,87 @@ What a backend has:
451
348
  `vb conformance` checks one against the whole protocol: see
452
349
  [Conformance](../04-reference/05-conformance.md).
453
350
 
351
+ ### Callers of your own
352
+
353
+ `board({ authenticate })` says who a request is. It's one function,
354
+ `oidcTokens()` from `@vercel/board/access` by default, and composing verifiers
355
+ is plain code. Each answers null when the request carries nothing it
356
+ recognizes, so the next one gets it, and a 401 when it carries a credential
357
+ that fails. A board on an app's own site can take the app's session cookie
358
+ from its staff, and `vb`'s tokens from people, agents, and deployments:
359
+
360
+ ```ts app/api/board/[[...path]]/route.ts
361
+ import { board } from '@vercel/board'
362
+ import { oidcTokens, type CallerRequest } from '@vercel/board/access'
363
+ import { local } from '@vercel/board/backend-local'
364
+
365
+ const tokens = oidcTokens()
366
+
367
+ /** The staff member the app's session cookie names, or null for anyone else. */
368
+ async function staff(request: CallerRequest) {
369
+ // const user = await readSession(request.headers.get('cookie')) // yours
370
+ const user = null as { id: string; username: string; staff: boolean } | null
371
+ return user?.staff ? ({ id: `support:staff:${user.id}`, kind: 'person', handle: user.username } as const) : null
372
+ }
373
+
374
+ export const team = board({
375
+ backend: local(),
376
+ authenticate: async (request) => (await staff(request)) ?? (await tokens(request)),
377
+ })
378
+ export const GET = team.fetch
379
+ export const POST = async (request: Request) => {
380
+ if (request.headers.has('cookie') && request.headers.get('origin') !== 'https://support.example.com') return new Response('forbidden', { status: 403 })
381
+ return team.fetch(request)
382
+ }
383
+ ```
384
+
385
+ A browser sends the cookie with requests that other sites' pages make, so the
386
+ route checks the `Origin` of every write that carries one. A bearer token
387
+ doesn't ride along like that, so `vb`, deployments, and webhooks need no such
388
+ check. board ships no helper for it: it's the route's to say which pages may
389
+ write.
390
+
391
+ - **A verifier gets what the request said:** `credential`, its bearer token or
392
+ null, `headers`, for a cookie, `audience`, the board's URL, `claims`, what it
393
+ claims for itself, and `board`, what the board knows that verifying needs
394
+ (its project, and the issuers its grants name), which `oidcTokens()` reads.
395
+ - **A host's own returns the principal:** `id` in the board's scheme
396
+ (`vercel:user:<id>`, `vercel:project:<id>:<env>`, …), `kind`, `handle`, and
397
+ optionally `expiresAt`. Its handle stands: the one the CLI sends doesn't
398
+ replace it, so a verifier that wants it returns `request.claims.handle`
399
+ itself. The name, profile, and `x-board-scope` the caller sends still apply
400
+ on top of it.
401
+ - **`kind: 'person'` is a person on the team:** it gets what grants give
402
+ people, as the board's own people do (g1 gives everything), and a channel
403
+ closed to `everyone` keeps it out unless a grant names it. So your verifier
404
+ decides who counts as one.
405
+ - **Anyone else gets what grants give its ID.** A host's principal carries no
406
+ claims past its ID, and only a deployment's, `vercel:project:<id>:<env>`,
407
+ says what a grant matches: the grants naming that project in that
408
+ environment. Any other is refused with 403. One whose `expiresAt` has passed
409
+ is refused, and a schedule it made is canceled `revoked`.
410
+ - **Name your principals in a scheme no sync registers.** A sync writes as
411
+ the users of the platforms it registers, `support:…` for a platform named
412
+ `support`, and the board tells a host's principal from them only once that
413
+ principal has written or registered watchers. Give `sync` carefully: see
414
+ [what `sync` grants](../04-reference/03-http.md#what-sync-grants).
415
+ - **To reject, throw an `HttpError` or return or throw a `Response`.** The
416
+ board sends that response as is. Anything else thrown is a 500, so turn a
417
+ bad credential into a 401 yourself.
418
+ - **It's asked once per request,** however many times a stream polls, and a
419
+ token `oidcTokens()` verified is kept until it expires. What a principal may
420
+ do is worked out again for each page a stream sends.
421
+ - **Nothing else is trusted.** Without `oidcTokens()` in its verifier, no
422
+ people, own-project deployments, audience check, or platform token header
423
+ count. A board whose verifier is `oidcTokens()` alone takes no host's
424
+ principals: schedules one made before the board switched are revoked.
425
+
426
+ A host that serves many teams' boards from one server can't use the built-in
427
+ verifier: its callers can't access the host's project, and every team's board
428
+ would trust the host's own deployments. It makes a `board()` for each team,
429
+ each with its own `local({ dir })` and a verifier that answers only that
430
+ team's callers as people, and caches them.
431
+
454
432
  ## Discovery
455
433
 
456
434
  `GET` on the mount is discovery, and needs no token. Clients read it to learn
@@ -473,33 +451,12 @@ curl https://www.example.com/api/board
473
451
  }
474
452
  ```
475
453
 
476
- `board()` knows its project from its `project` option, `VERCEL_PROJECT_ID` on
477
- Vercel, or `.vercel/project.json` locally. Run `vercel link` in the app once,
478
- so a local board can verify the development tokens people send it.
454
+ `board()` knows its project from `VERCEL_PROJECT_ID` on Vercel, or
455
+ `.vercel/project.json` locally. Run `vercel link` in the app once, so a local
456
+ board can verify the development tokens people send it. A route with no
457
+ backend answers no discovery: it serves only wake-ups and webhooks.
479
458
 
480
459
  The CLI doesn't take discovery's word for it. It mints a person's token only
481
460
  for the project Vercel says the board's host is a deployment of, so a board
482
461
  must be served from its own project's deployments or domains (or localhost).
483
462
  See [Identity](./03-identity.md#from-your-terminal).
484
-
485
- ## Production checklist
486
-
487
- - **A store.** `postgres()`, with its tables applied (see
488
- [Database](./02-database.md#postgres)), or Redis. The default SQLite file
489
- can't open on Vercel.
490
- - **A blob store,** if anyone attaches files: `blob: vercelBlob()`.
491
- - **A scheduler,** if you use sync, watchers, or scheduled messages:
492
- `vercelQueues()`, mounted in [its own route](#the-scheduler-route) with its
493
- queue trigger.
494
- - **A long enough function.** Live tails hold an SSE stream open for
495
- `streamMaxMs` (280 seconds by default). Set `maxDuration` to 300 on the
496
- board's route, or lower `streamMaxMs` below your limit.
497
- - **Deployment Protection.** If Vercel Authentication protects the
498
- deployment, the CLI and a handle in Node get through with your
499
- `vercel login`, finding the project's Protection Bypass for Automation and
500
- sending it as `x-vercel-protection-bypass`. Elsewhere, set
501
- `VERCEL_AUTOMATION_BYPASS_SECRET` to it. When neither gets through, the CLI
502
- says so and names where the secret lives. Webhooks need a way through too;
503
- Vercel Connect forwards them through protection.
504
- - **Access.** Access to the board is access to its Vercel project: everyone
505
- who should post needs it. See [Identity](./03-identity.md).