feat(web): rewrite viewer with Hono + JSX, add Cloudflare Workers deploy#13
Merged
Conversation
Replace the Next.js app with a Hono + JSX SSR codebase that runs on both Cloudflare Workers (R2 native binding) and Node/Railway (S3-compatible via @aws-sdk/client-s3 fallback). Single src/app.tsx is shared by both entries; storage layer picks the backend at runtime based on env.BUCKET. Workers bundle is gzip 188KB — well under the 1MB free-tier limit. Tailwind v4 CSS is built into public/ and served by wrangler [assets] on Workers and @hono/node-server/serve-static on Node. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@aws-sdk/client-s3fallback in a shared storage layerWhy
Next.js viewer was overspec for a read-only S3 lister. Moving to Hono drops the bundle small enough for Workers free tier, enables R2 native binding (no credentials inside Worker), and keeps a single
src/app.tsxdriving both Node and Workers entries.Architecture
src/app.tsx— shared Hono appsrc/index.tsx— Cloudflare Workers entrysrc/node.ts— Node entry (Railway / local) via@hono/node-serversrc/lib/storage.ts— picks R2 binding ifenv.BUCKETexists, else dynamic-imports aws-sdksrc/middleware/basic-auth.ts— opt-in basic auth (unchanged behavior)wrangler.toml—[assets]for Tailwind CSS,[[r2_buckets]]binding,nodejs_compatrailway.json— preserved for Node deploysVerification
npm run typecheck— passesnpm run build:css— Tailwind v4 generates 9KB CSSwrangler deploy --dry-run— Total Upload 1.16 MiB / gzip 188 KiB (well under 1 MiB free-tier limit)Test plan
npm run devlocally with.env.localpopulated →/lists sessions,/session/<key>rendersnpm run dev:cfwithwrangler r2 bucket create cchist+ dummy objects → R2 binding path worksSTORAGE_*env vars🤖 Generated with Claude Code