Since 2026-09-24, logicola.org is a Next static export served by
Cloudflare Workers. Every page, chunk, image and feed is a file in
out/, served as Workers static assets. The only code that runs per
request is worker/index.ts, and only for /api/* (the newsletter).
This is the runbook: how a deploy is shaped, the rules the static export imposes, and how to ship, configure, verify and roll back. The move itself is PR #176; Vercel was retired the same day.
In September 2026 the Vercel Hobby plan went over three limits over its 30-day window. ISR Writes were at 449K of 200K, Edge Requests at 1M of 1M, and Fast Origin Transfer at 10.13 GB of 10 GB (ISR Reads were at 699K of 1M). On Hobby, going over means a possible pause rather than a bill. Logs pointed at two causes, both in LogiCola:
- The blog link cards never prerendered.
opengraph-image.tsxusedgenerateImageMetadata, and Next's wrapper replaces the file'sgenerateStaticParams. So every card rendered on demand, and every expiry was an ISR write of about 55 KB (7 write units). - The offline precache. Each new visitor's service worker fetches the whole manifest, about 115 URLs, and on Vercel every one of those was a metered edge request. The quiz pages among them were ISR reads.
Every page was already prerendered, so a static host could serve the same site. On Cloudflare, static asset requests are free and unmetered.
browser ──▶ Cloudflare (zone logicola.org, account "Malik")
│
├─ www.logicola.org/* ── zone Redirect Rule (301, keeps path + query) ──▶ logicola.org
│
└─ logicola.org/* ── Worker route ──▶ Worker "logicola"
├─ matches a file in out/ → static asset (the Worker never runs; free)
├─ /api/* → worker/index.ts → Loops (newsletter)
└─ anything else → out/404.html, status 404
logicola.org's DNS record is an originless placeholder,A 192.0.2.0(proxied). A route only runs for a hostname that has a proxied record, so the record has to exist, but requests never reach its address. Don't delete it.www's record is there for the same reason: the Redirect Rule needs something proxied to act on.- Mail on logicola.org is Cloudflare Email Routing (the MX records). The move didn't touch it.
Read these before adding anything that runs on a server. Most of them
fail next build loudly; rule 7 fails quietly.
- Nothing renders per request. No API routes, POST handlers,
Server Actions, middleware/proxy,
cookies()/headers()/ serversearchParams, ISR (revalidate), or draft mode.next buildrejects most of these with "cannot be used with output: export". - Route handlers are static, metadata routes included.
robots,sitemap, the feeds andfooter-band.svgall exportdynamic = 'force-static'. Dynamic segments needgenerateStaticParams(anddynamicParams = false). - Server code goes in
worker/index.ts, with tests inworker/index.test.ts. It runs only for/api/*(run_worker_firstinwrangler.jsonc). Keep status codes meaningful: the newsletter form readsresponse.okand reportsstatus_codeto PostHog. - Never use
generateImageMetadata. Next's wrapper drops the file'sgenerateStaticParams, so the image never prerenders. Under the export that is a build error; on Vercel it failed quietly, as an ISR write per request, which is why it matters if the export is ever turned off. The link cards areapp/(marketing)/blog/[slug]/card.png/route.tsx, and theirog:imagewith its alt text is set in the post page'sgenerateMetadata. - There is no image optimizer (
images.unoptimized: true).next/imagestill gives width/height and lazy loading, but the file ships as committed, so size and compress images before adding them. - Redirects go in
public/_redirects, headers inpublic/_headers. Workers reads both and never serves them as files. Neither applies to responses the Worker generates, so set/api/*headers in the Worker's code. - Anything generated after
next buildwrites intoout/(fails quietly). The export copiespublic/intoout/beforepostbuildruns, so a file written topublic/at that point misses the deploy. The offline manifest is written toout/offline-manifest.jsonfor this reason.
| File | Role |
|---|---|
next.config.mjs |
output: 'export', images.unoptimized |
wrangler.jsonc |
The Worker: assets from out/, 404 page, trailing-slash handling, /api/* to the Worker, the route, observability |
worker/index.ts |
/api/newsletter (Loops); other /api/* paths get the 404 page |
public/_redirects |
The moved Set R post; old link-card URLs → card.png |
public/_headers |
Year-long cache on /_next/static/*, RSS content types, noindex on *.workers.dev |
scripts/generate-offline-manifest.mjs |
Postbuild: writes out/offline-manifest.json |
Pushing to main builds and deploys. Other branches get a preview URL
on *.upfra-me.workers.dev, which _headers marks noindex. Settings
live at Workers & Pages → logicola → Settings → Build:
| Setting | Value |
|---|---|
| Repository / production branch | malikpiara/logicola / main |
| Build command | pnpm build |
| Deploy command | npx wrangler deploy (default) |
| Preview command (other branches) | npx wrangler preview (default, open beta), which produces a preview URL |
| Build variables | NEXT_PUBLIC_POSTHOG_KEY, NEXT_PUBLIC_POSTHOG_HOST |
| Node | The build image's default (24.x, as on Vercel). CI runs 22. |
| Wrangler | The version in package.json; Workers Builds uses the project's own. |
pnpm build && pnpm cf:deployThis builds with .env.local's NEXT_PUBLIC_* values and deploys from
your machine (wrangler is logged in to the "Malik" account).
| Variable | Where it lives | Read by | Notes |
|---|---|---|---|
NEXT_PUBLIC_POSTHOG_KEY |
Workers Builds build variable; .env.local locally |
next build (inlined into client JS) |
Public by design, but kept out of git so forks don't report into this project. |
NEXT_PUBLIC_POSTHOG_HOST |
Same | Same | |
LOOPS_API_KEY |
Worker secret: pnpm exec wrangler secret put LOOPS_API_KEY |
worker/index.ts |
Without it the endpoint answers 503. |
LOOPS_MAILING_LIST_ID |
Worker secret, optional | worker/index.ts |
Not set as of 2026-09-24, so signups become subscribed contacts without a list. |
Secrets survive deploys. wrangler secret list shows names, never
values. Previews inherit nothing from production (no route, no secrets;
they keep their own, wrangler preview secret), so a preview's newsletter
answers 503, which keeps branch testing from subscribing anyone. The
empty previews block in wrangler.jsonc is required: without it
wrangler preview refuses to run, which is how the first branch build
failed.
pnpm dev(next dev) has no/api/newsletter, because the endpoint lives in the Worker. The newsletter form shows its error state there, and that's expected.pnpm startrunswrangler devon port 3000 afterpnpm build. It servesout/plus the Worker with production's routing (_headers,_redirects, the 404 page). It loads.env.local, because wrangler reads.env*files when there's no.dev.vars. SoLOOPS_API_KEYis the real key, and a signup there subscribes for real. To keep local signups off Loops, create a.dev.vars(gitignored) withoutLOOPS_API_KEY. Its presence stops wrangler reading.env*files, and the endpoint answers 503.
curl -sI https://logicola.org/ | grep -iE "^(HTTP|cache-control)"Expect a 200. Right after a route change, give it up to a minute to propagate across Cloudflare before worrying. What each path should do:
| Request | Expected |
|---|---|
/, a quiz, a blog post |
200 text/html, max-age=0, must-revalidate |
/blog/ |
307 → /blog |
/blog/set-r-informal-fallacies |
308 → /blog/informal-fallacies |
/blog/<slug>/opengraph-image-yqks0s/card |
308 → /blog/<slug>/card.png |
/_next/static/… |
max-age=31536000, immutable |
/blog/feed.xml, /release-notes/feed.xml |
application/rss+xml |
| an unknown path | 404 with the export's 404 page |
GET /api/newsletter / POST with a bad email |
405 / 400 JSON |
www.logicola.org/<path>?<query> |
301 → logicola.org/<path>?<query> |
Then run the offline check in docs/release-checks.md. Failed
newsletter signups show up in Workers Logs (logicola → Observability)
as newsletter subscribe failed:.
- A bad build. Roll the Worker back to its previous version, either
in the dashboard (logicola → Deployments) or with
pnpm exec wrangler rollback. Only the code and assets change; the route stays. - There is no second host. Vercel was retired on 2026-09-24, so a
Cloudflare outage takes the site down with it. In an emergency,
out/is plain files that any static host can serve; only/api/newsletterwould need an equivalent. Point the zone'slogicola.orgrecord at that host and delete thelogicola.org/*route.
Vercel ran LogiCola until 2026-09-24 and was retired the same day, once Cloudflare was serving:
- The cutover used a Worker route in front of Vercel's DNS records, so deleting the route was an instant way back while that mattered.
- To retire Vercel, the
logicola.orgrecord was repointed in place to the placeholder192.0.2.0, keeping the route, andwww's record was repointed away from Vercel too. A custom domain was tried first and refused: Cloudflare won't attach one while the hostname has a record it doesn't manage (code 100117). Deleting the record first would work, but it opens a gap that resolvers can cache as "no address" for up to ~30 minutes. beta.logicola.org, an old branch domain that only returned Vercel's 404, went with the Vercel project, and so didvercel.json.
If you want a custom domain later: it's tidier (Cloudflare manages
the record and the certificate) but gains nothing functional. Do it at a
quiet hour: delete the logicola.org record, then straight away swap
the route in wrangler.jsonc for
{ "pattern": "logicola.org", "custom_domain": true } and deploy. Then
delete the leftover route in the dashboard, because wrangler never
deletes routes removed from its config.
The Cloudflare account is on Workers Paid ($5/month, shared by every Worker in the account, Cherrydock included). As checked in Cloudflare's docs on 2026-09-24:
- Static asset requests: free and unlimited on every plan. That covers every page, chunk, image and the service worker's precache, which is almost all of LogiCola's traffic.
- Worker requests: 10 million a month included, then $0.30 per million.
Only
/api/*runs the Worker. On launch day that was 3 invocations, all newsletter checks. - CPU: 30 million CPU-ms a month included, and up to 30 s per request by default. The newsletter handler mostly waits on Loops, and waiting isn't CPU time.
- 100,000 files per version (the export is about 480) and 25 MiB per file.
So LogiCola adds nothing to the bill: static requests are free, and the newsletter's Worker requests are a rounding error inside what's included. (Corrected 2026-09-24: this section first described Workers Free, whose 100,000 requests a day and 10 ms CPU cap don't apply to this account.)
generateImageMetadatanever prerenders (rule 4). Its wrapper's owngenerateStaticParamsfills only the image id, neverslug.scripts/offlineManifest.test.tsskips itself when there's no build. While it still pointed atpublic/, it skipped silently. It now readsout/, so runpnpm buildbefore trusting a greenpnpm teston manifest changes.- A route (not a custom domain) needs a proxied DNS record for its
hostname. Here that's the placeholder
A 192.0.2.0record. - Wrangler turns off the
workers.devURL and preview URLs once a route exists, unlesswrangler.jsoncsets them. Both are set. - Cloudflare won't attach a Workers custom domain to a hostname that has a DNS record it doesn't manage (code 100117), even though wrangler offers to override conflicts; the record has to be deleted first.
- Wrangler never deletes a route you remove from
wrangler.jsonc. It warns and leaves it, so delete routes in the dashboard. /blog/redirects with a 307 on Workers (Vercel sent a 308). The difference doesn't matter.- The
cloudflare-apiMCP (mcp.cloudflare.com) can't sign in from the Claude desktop app, because it rejects the app'sclaude://OAuth redirect. The builds, observability and bindings MCPs work.