From 9d163cdcf2b30dafb06b294ea5fd24ddbab95f6e Mon Sep 17 00:00:00 2001 From: Barry Prendergast Date: Fri, 20 Nov 2026 23:11:06 +0000 Subject: [PATCH 1/2] docs: deploy from the lanyards project, not lanyards-next (#154) The swap keeps the existing Vercel project, `lanyards`, which already owns lanyards.app: it switches to Root Directory `web`, and next.lanyards.app moves to it. The README's deploy guide now covers lanyards.app: project settings, variables, domains (apex primary, www 308, next retired by web/vercel.json) and checks. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PSPB1cH898qV61BH1NiFKL --- CLAUDE.md | 2 +- web/README.md | 82 +++++++++++++++----------- web/src/lib/origin/movedOrigin.test.ts | 4 +- 3 files changed, 50 insertions(+), 38 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index ca4d084..8a3aee1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -74,7 +74,7 @@ The repository holds two apps during the rebuild (epic #94): - **Protocol**: `@atcute/*` packages (client, lexicons, identity resolver) - **Copy**: British English via Lingui (`web/src/i18n/`) - **Tests**: Vitest + Testing Library + MSW + axe-core; Playwright for e2e -- **Hosting**: Vercel project `lanyards-next` with Root Directory `web`, serving `lanyards.app` (`PUBLIC_BASE_URL=https://lanyards.app` in Production). `www` and the retired `next.lanyards.app` redirect to it (#154) +- **Hosting**: Vercel project `lanyards` with Root Directory `web`, serving `lanyards.app` (`PUBLIC_BASE_URL=https://lanyards.app` in Production). `www` and the retired `next.lanyards.app` redirect to it (#154) **Repository root: the legacy Next.js app.** It is frozen and no longer served: `lanyards.app` moved to the new app (#154), and Slice 1c (#103) deletes it. Don't start new work on it. diff --git a/web/README.md b/web/README.md index 102b73f..2440087 100644 --- a/web/README.md +++ b/web/README.md @@ -121,23 +121,23 @@ Lanyards' lexicons are published from the `@lanyards.app` account bsky.social caches a failed lexicon lookup for about 5 minutes, so sign-in may keep falling back to broad permissions for a few minutes after publishing. -## Deploying the beta (`next.lanyards.app`) +## Deploying (`lanyards.app`) -The app deploys from a **second** Vercel project. The legacy project keeps -serving `lanyards.app` from the repository root until Slice 1c (#103). +The app deploys from the Vercel project **`lanyards`** (team `renderghost`, +Git repo `renderghost/lanyards`), with Root Directory `web`. Until the swap +(#154), that project served the legacy Next.js app from the repository root, +and the beta ran on a second project, `lanyards-next`, at +`next.lanyards.app`. -### 1. Create the Vercel project +### 1. Project settings -In the Vercel dashboard (team `renderghost`): **Add New → Project →** import -`renderghost/lanyards`, then set: - -| Setting | Value | -| ----------------- | ----------------------------------------------- | -| Project name | `lanyards-next` | -| Framework preset | Vite | -| Root Directory | `web` | -| Build and output | leave as detected (`web/vercel.json` sets them) | -| Production branch | `main` (Settings → Git, after creation) | +| Setting | Value | +| ------------------------- | -------------------------------------------------- | +| Root Directory | `web` | +| Framework preset | Vite | +| Build, output and install | no overrides (`web/vercel.json` sets build/output) | +| Node.js version | from `engines` in `web/package.json` | +| Production branch | `main` | Keep **Settings → Environment Variables → "Automatically expose System Environment Variables"** on, because preview builds use `VERCEL_ENV` and @@ -145,37 +145,49 @@ Environment Variables"** on, because preview builds use `VERCEL_ENV` and ### 2. Environment variables -| Name | Environment | Value | -| ------------------- | ----------- | --------------------------- | -| `PUBLIC_BASE_URL` | Production | `https://next.lanyards.app` | -| `VITE_POSTHOG_KEY` | — | leave unset during the beta | -| `VITE_POSTHOG_HOST` | — | leave unset during the beta | +| Name | Environment | Value | +| ------------------- | ------------------- | ---------------------------------- | +| `PUBLIC_BASE_URL` | Production only | `https://lanyards.app` | +| `VITE_POSTHOG_KEY` | Production, Preview | optional: analytics is off without | +| `VITE_POSTHOG_HOST` | Production, Preview | optional: defaults to PostHog's EU | Production builds fail on purpose without `PUBLIC_BASE_URL`, because the -OAuth client metadata is generated from it. +OAuth client metadata is generated from it. Don't set it for Preview: +previews use their own branch URL. -### 3. Domain +### 3. Domains -1. In the project: **Settings → Domains → Add** `next.lanyards.app`. -2. `lanyards.app` uses Cloudflare DNS. Add this record in Cloudflare: +| Domain | Setting | +| ------------------- | --------------------------------------------------------- | +| `lanyards.app` | Production, primary | +| `www.lanyards.app` | Redirect to `lanyards.app`, 308 | +| `next.lanyards.app` | Production, **no** redirect: `web/vercel.json` handles it | - | Type | Name | Target | Proxy status | - | ----- | ------ | ---------------------- | --------------------- | - | CNAME | `next` | `cname.vercel-dns.com` | DNS only (grey cloud) | +`next.lanyards.app` is the retired beta. `web/vercel.json` redirects its +page visits to the same path on `lanyards.app`, and only page visits, so a +copy installed from the beta can still fetch its update. The updated app +then sends it to `lanyards.app` (`src/lib/origin/movedOrigin.ts`). A Vercel +domain redirect would cut installed copies off from their update. - Keep the proxy off so Vercel can issue the certificate. +DNS is on Cloudflare. Keep every Vercel record **DNS only** (grey cloud) so +Vercel can issue certificates. The `_atproto` TXT record verifies the +`@lanyards.app` Bluesky handle, and the `_lexicon` TXT records publish the +lexicons (see above). ### 4. Check the deployment -After the first production deployment from `main`: +After a production deployment from `main`: ```bash -curl -s https://next.lanyards.app/oauth-client-metadata.json -# → JSON whose client_id is https://next.lanyards.app/oauth-client-metadata.json -curl -sI https://next.lanyards.app/oauth-client-metadata.json | grep -i content-type +curl -s https://lanyards.app/oauth-client-metadata.json +# → JSON whose client_id is https://lanyards.app/oauth-client-metadata.json +curl -sI https://lanyards.app/oauth-client-metadata.json | grep -i content-type # → application/json -curl -s -o /dev/null -w '%{http_code}\n' https://next.lanyards.app/settings -# → 200 +curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' https://www.lanyards.app/renderg.host +# → 308 https://lanyards.app/renderg.host +curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' \ + -H 'sec-fetch-dest: document' https://next.lanyards.app/renderg.host +# → 308 https://lanyards.app/renderg.host ``` Then sign in with a real account, check your name and handle on `/settings`, @@ -185,5 +197,5 @@ sign out, and install the app on a phone and open it offline. Preview builds work, but Vercel protects previews with Vercel Authentication by default. Bluesky's servers can't fetch a protected preview's OAuth -metadata, so **sign-in only works on `next.lanyards.app`** (or locally) -unless you relax deployment protection for previews. +metadata, so **sign-in only works on `lanyards.app`** (or locally) unless +you relax deployment protection for previews. diff --git a/web/src/lib/origin/movedOrigin.test.ts b/web/src/lib/origin/movedOrigin.test.ts index 5a42203..a5663b1 100644 --- a/web/src/lib/origin/movedOrigin.test.ts +++ b/web/src/lib/origin/movedOrigin.test.ts @@ -30,8 +30,8 @@ describe('movedTo (#154)', () => { it('leaves every other origin alone: previews, local, Vercel URLs', () => { for (const href of [ - 'https://lanyards-next-git-x-renderghost.vercel.app/', - 'https://lanyards-next.vercel.app/', + 'https://lanyards-git-x-renderghost.vercel.app/', + 'https://lanyards-three.vercel.app/', 'http://127.0.0.1:5173/', ]) { expect(movedTo(href, HOME)).toBeNull(); From 9c3ed80ce9d721afdd9333ce17b40efa3113e2d1 Mon Sep 17 00:00:00 2001 From: Barry Prendergast Date: Fri, 20 Nov 2026 23:14:20 +0000 Subject: [PATCH 2/2] fix: redirect the beta's home page to lanyards.app too (#154) Vercel's `/:path*` doesn't match the bare root, so a visit to https://next.lanyards.app/ still got the beta while every other path redirected. The root now has its own rule, with the same host and page-visit conditions. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PSPB1cH898qV61BH1NiFKL --- web/README.md | 8 +++++--- web/scripts/vercelConfig.test.ts | 11 +++++++++++ web/vercel.json | 9 +++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/web/README.md b/web/README.md index 2440087..9400d5e 100644 --- a/web/README.md +++ b/web/README.md @@ -185,9 +185,11 @@ curl -sI https://lanyards.app/oauth-client-metadata.json | grep -i content-type # → application/json curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' https://www.lanyards.app/renderg.host # → 308 https://lanyards.app/renderg.host -curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' \ - -H 'sec-fetch-dest: document' https://next.lanyards.app/renderg.host -# → 308 https://lanyards.app/renderg.host +for path in / /renderg.host; do + curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' \ + -H 'sec-fetch-dest: document' "https://next.lanyards.app$path" +done +# → 308 https://lanyards.app/ and 308 https://lanyards.app/renderg.host ``` Then sign in with a real account, check your name and handle on `/settings`, diff --git a/web/scripts/vercelConfig.test.ts b/web/scripts/vercelConfig.test.ts index fd09291..f86329f 100644 --- a/web/scripts/vercelConfig.test.ts +++ b/web/scripts/vercelConfig.test.ts @@ -34,7 +34,18 @@ describe('vercel.json', () => { // subdomain's pages move to lanyards.app (#154); only page visits, so // an installed copy's service worker can still fetch its update there. it('sends next.lanyards.app pages to lanyards.app, and /@handle to /handle', () => { + const beta = [ + { type: 'host', value: 'next.lanyards.app' }, + { type: 'header', key: 'sec-fetch-dest', value: 'document' }, + ]; expect(config.redirects).toEqual([ + // Vercel's /:path* doesn't match the bare root, so it has its own. + { + source: '/', + has: beta, + destination: 'https://lanyards.app/', + permanent: true, + }, { source: '/:path*', has: [ diff --git a/web/vercel.json b/web/vercel.json index 9f67237..4f3b3a1 100644 --- a/web/vercel.json +++ b/web/vercel.json @@ -13,6 +13,15 @@ } }, "redirects": [ + { + "source": "/", + "has": [ + { "type": "host", "value": "next.lanyards.app" }, + { "type": "header", "key": "sec-fetch-dest", "value": "document" } + ], + "destination": "https://lanyards.app/", + "permanent": true + }, { "source": "/:path*", "has": [