diff options
| author | Joe Mou <dev@mou.fo> | 2026-07-15 02:08:17 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-07-15 02:08:29 -0400 |
| commit | 9b556ffe6c0c0528697e15f7f4f35107de212ce1 (patch) | |
| tree | 7f87bd7d58c4bc9a640a669fa314fec6c49c82df /cgithub/CLAUDE.md | |
| parent | 9fbb5f0d68a131b55bc172d46b75705f2842af04 (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 'cgithub/CLAUDE.md')
| -rw-r--r-- | cgithub/CLAUDE.md | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cgithub/CLAUDE.md b/cgithub/CLAUDE.md index 827cc3b..1bf4d88 100644 --- a/cgithub/CLAUDE.md +++ b/cgithub/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 |
