aboutsummaryrefslogtreecommitdiff
path: root/CLAUDE.md
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-07-15 02:08:17 -0400
committerJoe Mou <dev@mou.fo>2026-07-15 02:08:29 -0400
commitfb16dc2b017e339e6a36a89c9b5d8a830ce3a541 (patch)
tree640775bc65b7a14019df8aea789a00e65023d3bb /CLAUDE.md
parent0f4681d55b9d865a4e860fb3f28203ffd0bdc034 (diff)
Add Cloudflare Workers deployment target
Split routes into a shared createApp() (src/app.ts) used by both the Node entry (src/index.ts) and a new Workers entry (src/worker.ts). Workers disallow runtime code generation, so scripts/compile-views.ts precompiles the Eta templates into src/views.generated.ts and rendering switches from renderAsync to the sync render. Static files move to public/static so Workers Static Assets can serve them; the Node build and serveStatic root are updated to match. Deploy with pnpm run deploy:cf, local dev with pnpm run dev:cf. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md12
1 files changed, 10 insertions, 2 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 827cc3b..1bf4d88 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -13,6 +13,10 @@ pnpm run build
# Run tests
pnpm test
+
+# Cloudflare Workers: local dev and deploy
+pnpm run dev:cf
+pnpm run deploy:cf
```
## Architecture
@@ -20,10 +24,14 @@ pnpm test
**Stack:** Hono (web framework) + Eta (templating) + TypeScript, bundled with esbuild
**Source files:**
-- `src/index.ts` - Hono routes and server setup (supports systemd socket activation via `LISTEN_FDS=1`)
+- `src/app.ts` - Hono routes, shared by both entry points
+- `src/index.ts` - Node server entry (supports systemd socket activation via `LISTEN_FDS=1`)
+- `src/worker.ts` - Cloudflare Workers entry (config in `wrangler.jsonc`)
- `src/scraper.ts` - GitHub HTML fetching and JSON extraction logic
-**Templates:** `views/*.eta` - Eta templates with layout inheritance (`layout.eta` as base)
+**Templates:** `views/*.eta` - Eta templates with layout inheritance (`layout.eta` as base). On Workers, runtime code generation is disallowed, so `scripts/compile-views.ts` precompiles templates to `src/views.generated.ts` (gitignored, regenerated by the `dev:cf`/`deploy:cf` scripts).
+
+**Static files:** `public/static/*`, served by `@hono/node-server` on Node and by Workers Static Assets on Cloudflare.
**Routes:**
- `GET /:owner` - User or organization profile with pinned repositories