Skip to content
401 linesCodeBlameRaw
1// Everything g1t deploys to Cloudflare, in one place. Read by
2// scripts/deploy.mjs (plan, deploy), deploy/self-host/configs.mjs (what a
3// self-hosted installation runs) and the tests in scripts/deploy/.
4// docs.g1t.sh/guides/deploy-to-cloudflare/ explains each field and how to
5// add a unit.
6//
7// What is written here is what the Wrangler configs cannot say. The rest is
8// read from each unit's wrangler.jsonc, never copied: its D1 databases and
9// migrations, the services it binds to, its KV, R2, queues and routes. The
10// shared crates and packages a unit is built from are read from Cargo's and
11// npm's workspace metadata. `worker` and `d1` are written here too, so the
12// file reads as an inventory, and a test checks they match the configs.
13{
14 // Deployed in this order. A stage starts only when the one before it
15 // succeeded. A unit binds only to units in its own stage or an earlier
16 // one (a test checks it), so new code never calls a service that has
17 // not shipped yet. Within a stage, units go out in parallel.
18 //
19 // migrations: every pending D1 migration, before any code.
20 // core: the services, reached through service bindings.
21 // edge: public endpoints other than the site: API, MCP, g1t.page, status
22 // (models is public too, but in core: agents binds to it).
23 // front: the site, sudo and the docs.
24 "stages": ["migrations", "core", "edge", "front"],
25
26 // Names for the resources the configs refer to by id, for setup
27 // commands and the docs. A test checks every KV id in a config is here.
28 "resources": {
29 "kv": {
30 "16a4232cb746418db53782aa068be693": "g1t-actions-blobs",
31 "e627b571f07047e187c03e1fc2b3bbdd": "g1t-avatars",
32 "14bc5c233d4c46a5bbf23b5367cce5fd": "g1t-domains",
33 "be765052d0124c2a935b3db4dff99f1f": "g1t-repos-git-cache"
34 }
35 },
36
37 // Each deployable unit, by short name (`--only events,web`).
38 //
39 // kind: rust-worker (worker-build), ts-worker (Wrangler bundles it),
40 // react-router (vite build first), astro (astro build first).
41 // secrets: names only; set with `npx wrangler secret put NAME` in its folder.
42 // setup: one-time steps no config can say, for a first deploy.
43 // self_host: what deploy/self-host does with it: "run" (in the one
44 // workerd), "off" (bound to the off Worker), "separate" (a
45 // process of its own), or "none".
46 // inputs: files outside its folder it is built from that no workspace
47 // metadata names (a test finds such imports).
48 // image: a Containers image (the guide's "The runner's images"):
49 // dockerfile the image a deploy ships: the base plus the binary
50 // crate the crate that binary is built from (and what it uses)
51 // base { context: the base's folder, lock: the file that
52 // records the base that was pushed }; the base is
53 // rebuilt only when its folder changes
54 // repository where both are pushed in Cloudflare's registry
55 "units": {
56 "events": {
57 "path": "services/events",
58 "kind": "rust-worker",
59 "worker": "g1t-events",
60 "d1": { "database": "g1t-events", "migrations": "migrations" },
61 "stage": "core",
62 "secrets": [],
63 "setup": [
64 "The dead-letter queue every queue consumer sends what it gave up on to, before any unit that names it deploys: npx wrangler queues create g1t-events-dlq"
65 ],
66 "self_host": "run"
67 },
68 "identity": {
69 "path": "services/identity",
70 "kind": "rust-worker",
71 "worker": "g1t-identity",
72 "d1": { "database": "g1t", "migrations": "migrations" },
73 "stage": "core",
74 "secrets": ["GITHUB_APP_CLIENT_SECRET", "IDENTITY_KEY"],
75 "setup": ["Email Sending on g1t.sh (the EMAIL binding)"],
76 "self_host": "run"
77 },
78 "repos": {
79 "path": "services/repos",
80 "kind": "rust-worker",
81 "worker": "g1t-repos",
82 "d1": { "database": "g1t-repos", "migrations": "migrations" },
83 "stage": "core",
84 // REPOS_KEY seals what its isolates share (src/shared.rs) and the
85 // API's tarball and zipball links (src/archive_links.rs), which
86 // fail without it.
87 "secrets": ["REPOS_KEY"],
88 "setup": [
89 "The Artifacts namespace `g1t` (the ARTIFACTS binding)",
90 "The R2 bucket `g1t-git-packs` (GIT_PACKS) with its lifecycle rule: `npx wrangler r2 bucket create g1t-git-packs`, then `npx wrangler r2 bucket lifecycle add g1t-git-packs expire-packs packs/ --expire-days 7 --abort-multipart-days 1`",
91 "The R2 bucket for nightly backups: npx wrangler r2 bucket create g1t-backups"
92 ],
93 "self_host": "run"
94 },
95 "work": {
96 "path": "services/work",
97 "kind": "rust-worker",
98 "worker": "g1t-work",
99 "d1": { "database": "g1t-work", "migrations": "migrations" },
100 "stage": "core",
101 "secrets": [],
102 "self_host": "run"
103 },
104 "search": {
105 "path": "services/search",
106 "kind": "rust-worker",
107 "worker": "g1t-search",
108 "d1": { "database": "g1t-search", "migrations": "migrations" },
109 "stage": "core",
110 "secrets": [],
111 "self_host": "run"
112 },
113 "projects": {
114 "path": "services/projects",
115 "kind": "ts-worker",
116 "worker": "g1t-projects",
117 "d1": { "database": "g1t-projects", "migrations": "migrations" },
118 "stage": "core",
119 "secrets": [],
120 "self_host": "run"
121 },
122 "chat": {
123 "path": "services/chat",
124 "kind": "ts-worker",
125 "worker": "g1t-chat",
126 "d1": { "database": "g1t-chat", "migrations": "migrations" },
127 "stage": "core",
128 "secrets": [],
129 "setup": [
130 "The D1 database, before the first deploy: npx wrangler d1 create g1t-chat, then put its id in services/chat/wrangler.jsonc"
131 ],
132 "self_host": "run"
133 },
134 // Artifacts: docs (a doc is one kind of artifact), their spaces,
135 // sharing and live rooms. It was g1t-docs-service (services/docs)
136 // until 2026-10; its resources kept their g1t-docs names. g1t-docs
137 // is the documentation site (apps/docs).
138 "artifacts": {
139 "path": "services/artifacts",
140 "kind": "ts-worker",
141 "worker": "g1t-artifacts",
142 "d1": { "database": "g1t-docs", "migrations": "migrations" },
143 "stage": "core",
144 "secrets": [],
145 "setup": [
146 "An installation that ran g1t-docs-service: move to g1t-artifacts as \"Renaming a Worker\" in docs.g1t.sh/guides/deploy-to-cloudflare/ says (its queue consumer first, then this Worker, which takes the old Worker's live rooms)",
147 "The D1 database, before the first deploy: npx wrangler d1 create g1t-docs, then put its id in services/artifacts/wrangler.jsonc",
148 "The R2 bucket for files in pages: npx wrangler r2 bucket create g1t-docs-files",
149 "The queue the events service sends it merges and pushes on (pages whose cited code changed, projects' docs): npx wrangler queues create g1t-events-docs. The service also sends its own backfill jobs to it (JOBS)",
150 "The Vectorize index agents recall Docs from: npx wrangler vectorize create g1t-docs --dimensions=768 --metric=cosine, with string metadata indexes on workspace_id and space_id (npx wrangler vectorize create-metadata-index g1t-docs --property-name=<name> --type=string)",
151 "The Vectorize index for artifacts (folios), before the first deploy with FOLIO_VECTORS: npx wrangler vectorize create g1t-folios --dimensions=768 --metric=cosine, with string metadata indexes on workspace_id, scope and kind (npx wrangler vectorize create-metadata-index g1t-folios --property-name=<name> --type=string). Without it, artifacts are searched and recalled by words"
152 ],
153 "self_host": "run"
154 },
155 "telemetry": {
156 "path": "services/telemetry",
157 "kind": "ts-worker",
158 "worker": "g1t-telemetry",
159 // No D1: each project's telemetry is kept in its own Durable
160 // Object's SQLite storage. Public at otel.g1t.sh (OTLP), and
161 // every app on g1t.page names it as its Tail Worker.
162 "stage": "core",
163 // CLOUDFLARE_EXPORT_KEY is optional (Cloudflare's own OpenTelemetry
164 // export of the apps), so it is not listed.
165 "secrets": [],
166 "setup": [
167 "Deployed once before the deployments service and the dispatcher, which name it (`node scripts/deploy.mjs deploy --only telemetry`): a binding or Tail Worker that names a Worker not yet there is refused"
168 ],
169 "self_host": "run"
170 },
171 "notify": {
172 "path": "services/notify",
173 "kind": "ts-worker",
174 "worker": "g1t-notify",
175 // No D1: each person's feed keeps its own state in its Durable
176 // Object's SQLite storage.
177 "stage": "core",
178 // The private half of the VAPID key pair browser pushes are signed
179 // with; without it, notifications are live in open tabs only.
180 // EXPO_ACCESS_TOKEN, for pushes to the phone app, is optional
181 // (only for an Expo project with enhanced push security), so it
182 // is not listed.
183 "secrets": ["VAPID_PRIVATE_KEY"],
184 "setup": [
185 "The VAPID key pair for browser push: `node scripts/ops/vapid-keys.mjs` prints both halves and stores nothing. Put the public half in VAPID_PUBLIC_KEY in services/notify/wrangler.jsonc, and the private half with `npx wrangler secret put VAPID_PRIVATE_KEY` in services/notify"
186 ],
187 "self_host": "run"
188 },
189 "agents": {
190 "path": "services/agents",
191 "kind": "ts-worker",
192 "worker": "g1t-agents",
193 "d1": { "database": "g1t-agents", "migrations": "migrations" },
194 "stage": "core",
195 "secrets": ["CONNECTORS_KEY"],
196 "setup": [
197 "The D1 database, before the first deploy: npx wrangler d1 create g1t-agents, then put its id in services/agents/wrangler.jsonc"
198 ],
199 // Replies route and gate model work exactly as runs do, with the
200 // runner's own modules: its routing policy and who may use hosted models.
201 "inputs": ["services/runner/src/model-env.ts", "services/runner/src/hosted.ts"],
202 "self_host": "run"
203 },
204 "billing": {
205 "path": "services/billing",
206 "kind": "rust-worker",
207 "worker": "g1t-billing",
208 "d1": { "database": "g1t-billing", "migrations": "migrations" },
209 "stage": "core",
210 "secrets": ["STRIPE_SECRET_KEY", "STRIPE_WEBHOOK_SECRET", "CLOUDFLARE_USAGE_TOKEN"],
211 "self_host": "run"
212 },
213 "integrations": {
214 "path": "services/integrations",
215 "kind": "rust-worker",
216 "worker": "g1t-integrations",
217 "d1": { "database": "g1t-integrations", "migrations": "migrations" },
218 "stage": "core",
219 "secrets": ["INTEGRATIONS_KEY", "GITHUB_APP_PRIVATE_KEY", "GITHUB_APP_WEBHOOK_SECRET"],
220 "self_host": "run"
221 },
222 "webhooks": {
223 "path": "services/webhooks",
224 "kind": "rust-worker",
225 "worker": "g1t-webhooks",
226 "d1": { "database": "g1t-webhooks", "migrations": "migrations" },
227 "stage": "core",
228 "secrets": ["WEBHOOKS_KEY"],
229 "self_host": "run"
230 },
231 "actions": {
232 "path": "services/actions",
233 "kind": "rust-worker",
234 "worker": "g1t-actions",
235 "d1": { "database": "g1t-actions", "migrations": "migrations" },
236 "stage": "core",
237 "secrets": ["ACTIONS_KEY"],
238 "self_host": "run"
239 },
240 "packages": {
241 "path": "services/packages",
242 "kind": "rust-worker",
243 "worker": "g1t-packages",
244 "d1": { "database": "g1t-packages", "migrations": "migrations" },
245 "stage": "core",
246 "secrets": ["PACKAGES_TOKEN_SECRET", "R2_ACCESS_KEY_ID", "R2_SECRET_ACCESS_KEY"],
247 "setup": [
248 "The D1 database: npx wrangler d1 create g1t-packages, its id in services/packages/wrangler.jsonc",
249 "The R2 bucket for packages' files: npx wrangler r2 bucket create g1t-packages",
250 "The events queue: npx wrangler queues create g1t-events-packages",
251 "For signed downloads: an R2 API token with read access to g1t-packages, as R2_ACCESS_KEY_ID and R2_SECRET_ACCESS_KEY"
252 ],
253 "self_host": "run"
254 },
255 "security": {
256 "path": "services/security",
257 "kind": "rust-worker",
258 "worker": "g1t-security",
259 "d1": { "database": "g1t-security", "migrations": "migrations" },
260 "stage": "core",
261 "secrets": [],
262 "self_host": "run"
263 },
264 "deployments": {
265 "path": "services/deployments",
266 "kind": "ts-worker",
267 "worker": "g1t-deployments",
268 "d1": { "database": "g1t-deployments", "migrations": "migrations" },
269 "stage": "core",
270 "secrets": ["CLOUDFLARE_API_TOKEN"],
271 "setup": [
272 "Workers for Platforms, and the dispatch namespace: scripts/setup-deployments.sh",
273 "Custom domains (Cloudflare for SaaS on g1t.page): scripts/setup-custom-domains.sh"
274 ],
275 "self_host": "run"
276 },
277 "runner": {
278 "path": "services/runner",
279 "kind": "ts-worker",
280 "worker": "g1t-runner",
281 "stage": "core",
282 "secrets": ["AI_GATEWAY_TOKEN"],
283 "setup": [
284 "Containers on the account; Docker on the machine that builds a new image",
285 "The base image, once: node scripts/deploy.mjs build-base"
286 ],
287 "image": {
288 "dockerfile": "services/runner/Dockerfile",
289 // The binary the image adds to its base (scripts/build-runner.mjs).
290 "crate": "g1t-runner",
291 "base": { "context": "services/runner/base", "lock": "services/runner/base.json" },
292 "repository": "g1t-runner"
293 },
294 "self_host": "off"
295 },
296 "context": {
297 "path": "services/context",
298 "kind": "ts-worker",
299 "worker": "g1t-context",
300 "d1": { "database": "g1t-context", "migrations": "migrations" },
301 "stage": "core",
302 "secrets": [],
303 "setup": [
304 "The Vectorize index: npx wrangler vectorize create g1t-context --dimensions=768 --metric=cosine, with metadata indexes on workspace, kind, project and private"
305 ],
306 "self_host": "off"
307 },
308 "og": {
309 "path": "services/og",
310 "kind": "ts-worker",
311 "worker": "g1t-og",
312 "stage": "core",
313 "secrets": [],
314 "setup": ["Browser Rendering on the account (the BROWSER binding)"],
315 // The roadmap cards read the site's roadmap.
316 "inputs": ["apps/web/app/lib/roadmap.ts"],
317 "self_host": "none"
318 },
319 "api": {
320 "path": "apps/api",
321 "kind": "rust-worker",
322 "worker": "g1t-api",
323 "stage": "edge",
324 // ACTIONS_OIDC_KEY signs workflow jobs' OIDC tokens; without it the
325 // issuer answers 404 and jobs are not offered tokens.
326 // ACTIONS_OIDC_KEY_PREVIOUS only while rotating (the guide's "OIDC
327 // tokens for workflow jobs").
328 "secrets": ["ACTIONS_OIDC_KEY"],
329 "setup": [
330 "The OIDC signing key for workflow jobs: an RSA key made with `openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048`, stored with `npx wrangler secret put ACTIONS_OIDC_KEY` (docs.g1t.sh/guides/deploy-to-cloudflare/#oidc-tokens-for-workflow-jobs)",
331 "The actions cache bucket's lifecycle rule limited to `c/`, so artifacts under `a/` are kept their retention-days (docs.g1t.sh/guides/deploy-to-cloudflare/#a-first-deploy-to-a-new-account)"
332 ],
333 "self_host": "separate"
334 },
335 "models": {
336 "path": "services/models",
337 "kind": "ts-worker",
338 "worker": "g1t-models",
339 // Core, though it is public at models.g1t.sh: the agents service
340 // reaches it by service binding for chat replies. It binds only to
341 // core services itself.
342 "stage": "core",
343 "secrets": ["AI_GATEWAY_TOKEN"],
344 "setup": ["The AI Gateway `g1t`"],
345 // Not run self-hosted, but bound to the off Worker: agents binds to it.
346 "self_host": "off"
347 },
348 "pages": {
349 "path": "services/pages",
350 "kind": "ts-worker",
351 "worker": "g1t-pages",
352 "stage": "edge",
353 "secrets": [],
354 "setup": ["A proxied wildcard DNS record on g1t.page (`*`, AAAA 100::): scripts/setup-deployments.sh"],
355 "self_host": "none"
356 },
357 "status": {
358 "path": "apps/status",
359 "kind": "ts-worker",
360 "worker": "g1t-status",
361 "d1": { "database": "g1t-status", "migrations": "migrations" },
362 "stage": "edge",
363 "secrets": ["STATUS_SECRET"],
364 "setup": ["Email Sending on g1t.sh (the EMAIL binding)"],
365 "self_host": "separate"
366 },
367 "web": {
368 "path": "apps/web",
369 "kind": "react-router",
370 "worker": "g1t",
371 "stage": "front",
372 // USERCONTENT_KEY signs the short-lived addresses of private
373 // repositories' files on g1tusercontent.com; without it they are
374 // served from g1t.sh instead.
375 "secrets": ["USERCONTENT_KEY"],
376 "setup": [
377 "The R2 bucket g1t-downloads, for the releases of the self-hosted runner, the CLI and the desktop app: npx wrangler r2 bucket create g1t-downloads",
378 "The zone g1tusercontent.com on the account; the Worker's custom domain on it is made by the deploy",
379 "The key for private files' addresses: `node -e \"console.log(require('crypto').randomBytes(32).toString('hex'))\" | npx wrangler secret put USERCONTENT_KEY` in apps/web"
380 ],
381 "self_host": "run"
382 },
383 "sudo": {
384 "path": "apps/sudo",
385 "kind": "react-router",
386 "worker": "g1t-sudo",
387 "stage": "front",
388 "secrets": [],
389 "setup": ["A Cloudflare Access application on sudo.g1t.sh; its AUD tag is ACCESS_AUD"],
390 "self_host": "none"
391 },
392 "docs": {
393 "path": "apps/docs",
394 "kind": "astro",
395 "worker": "g1t-docs",
396 "stage": "front",
397 "secrets": [],
398 "self_host": "none"
399 }
400 }
401}