Skip to content

Convert to static export for free hosting#21

Open
chanind wants to merge 2 commits into
mainfrom
static-export
Open

Convert to static export for free hosting#21
chanind wants to merge 2 commits into
mainfrom
static-export

Conversation

@chanind

@chanind chanind commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces Vercel SSR (fallback: "blocking") with Next.js output: 'export' for static hosting
  • Changelog pagination (~970 pages) stays fully statically generated at build time
  • Commit/item detail pages become client-side rendered, fetching pre-built JSON data chunks
  • Adds _redirects file for SPA fallback on Cloudflare Pages / Netlify
  • Build produces ~3000 files in ~35 seconds (vs. 50k+ pages that previously timed out)

How it works

  1. scripts/buildStaticData.ts pre-builds JSON data chunks:
    • Commits chunked by SHA prefix (256 buckets per version)
    • Items chunked by SHA256 hash of name (256 buckets per version)
  2. data/clientDatabase.ts fetches chunks in the browser using react-query
  3. ClientCommitPage/ClientItemPage render the same UI as before, but client-side
  4. _redirects handles SPA fallback + legacy URL redirects

Test plan

  • yarn build completes successfully (~35s)
  • Output contains 983 static HTML pages, 1024 data chunks, _redirects
  • Deploy to Cloudflare Pages / Netlify staging to test SPA fallback
  • Verify commit/item pages load data correctly
  • Verify search still works
  • Compare data with current live site

🤖 Generated with Claude Code

chanind and others added 2 commits March 31, 2026 22:00
Replace Vercel SSR (fallback: "blocking") with Next.js static export
(`output: 'export'`), enabling deployment to any static host (Cloudflare
Pages, Netlify, etc.) for free.

Approach:
- Changelog pagination pages (~970) are fully statically generated
- Commit/item detail pages use client-side rendering with pre-built
  JSON data chunks fetched at runtime
- Data is chunked by SHA prefix (256 buckets) for efficient loading
- _redirects provides SPA fallback for client-rendered routes

New files:
- scripts/buildStaticData.ts: pre-builds JSON data chunks
- data/clientDatabase.ts: browser-side data fetching
- components/ClientCommitPage.tsx, ClientItemPage.tsx: shared UI

Build produces ~3000 files in ~35 seconds (vs. 50k+ pages that
previously timed out).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add shell index.tsx pages alongside [sha].tsx/[name].tsx dynamic routes.
The shell pages generate HTML for _redirects SPA fallback (direct URL
access), while the dynamic routes register in Next.js's client-side
router (so <Link> navigation works correctly).

Reverts the <Link> → <a> changes since proper dynamic routes make
client-side navigation work as expected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant