Deploy a Serverless Interactive Website

This section resulted from a conversation with Patrick Freeland (LinkedIn, ATNI Tribes, Liken Knowledge) about the many projects he has been developing using Claude. See ATNI Climate and the specific project ATNI Climate Dynamic Drought Module, which has the following high-level system architecture:

flowchart LR
    Dev(["đź’» <b>Map Source</b><br/>Map design & layer settings"])

    BuildHost["⚙️ <b>Build & Web Hosting</b><br/>Packages app & publishes<br/>via GitHub Pages"]
    CommunityData["🌲 <b>Community & Live Data</b><br/>Tribal partner needs & live<br/>drought, wildfire & stream feeds"]

    Browser(["🖥️ <b>Visitor Browser</b><br/>Interactive map on demand<br/>No server maintenance"])

    Dev ==>|builds & publishes| BuildHost
    Dev ==>|co-designs with| CommunityData
    BuildHost ==>|delivers web app| Browser
    CommunityData ==>|streams live data| Browser
    Browser -.->|field feedback| Dev

    style Dev fill:#e0f2fe,stroke:#0284c7,stroke-width:2px,color:#0f172a
    style BuildHost fill:#eef2ff,stroke:#6366f1,stroke-width:2px,color:#0f172a
    style CommunityData fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#0f172a
    style Browser fill:#d1fae5,stroke:#059669,stroke-width:2px,color:#0f172a

See the detailed architecture slides for the full technical breakdown.

Prompt:

Explain how this repo uses npm or other tools to launch an interactive website via GitHub Pages. Likely there is useful information in DEVELOPER.md, .nvmrc and .github/. Include information on what is npm and other tools for a developer unfamiliar with this approach. Save in EXPLAIN_NPM.md in this directory.

Response:

This guide explains how this repository uses Node.js, npm, Vite, and GitHub Actions to build, verify, and host a interactive, high-performance web mapping application on GitHub Pages, which acts as a “serverless” high-speed static file server (CDN). It is written for developers, data scientists, and researchers who may be more familiar with Python, R, or traditional server architectures than the modern JavaScript/TypeScript ecosystem.


1. High-Level Architecture: How It Works Without a Backend

A common point of confusion for data scientists and developers coming from R (Shiny) or Python (Streamlit, Flask, Django) is: how can a complex, interactive mapping tool run on GitHub Pages without a backend server?

flowchart TD
    subgraph Dev["1. Development & Build (Local or CI)"]
        direction TB
        Src["Source Code<br/>• TypeScript (src/main.ts, src/layers/, etc.)<br/>• Styles (src/styles/)<br/>• Static Assets (public/data/)"]
        BuildEngine["Node.js + npm + Vite Bundler<br/>• tsc verifies static types<br/>• Vite bundles & minifies code<br/>• Splits MapLibre & PMTiles chunks"]
        Dist["Production Bundle (dist/)<br/>• index.html (with SHA stamp)<br/>• Optimized JS & CSS<br/>• Vector tiles & GeoJSON"]
        Src --> BuildEngine --> Dist
    end

    subgraph Hosting["2. GitHub Pages Deployment"]
        direction TB
        GHA["GitHub Actions (deploy.yml)<br/>• Checks out commit & runs gate<br/>• Uploads dist/ artifact<br/>• Publishes via actions/deploy-pages"]
        CDN["GitHub Pages CDN<br/>• Global HTTPS static hosting<br/>• HTTP Range-request support for tiles"]
        GHA --> CDN
    end

    subgraph Client["3. Client's Web Browser"]
        direction TB
        Browser["Visitor's Web Browser<br/>• Loads HTML, JS, CSS from Pages CDN<br/>• Executes MapLibre GL JS (WebGL / GPU)<br/>• Streams .pmtiles & remote COGs on demand<br/>• Directly queries public APIs (USGS, NIFC, NOAA, BCWS)"]
    end

    Dist --> GHA
    CDN --> Browser

Key Differences from Server-Driven Apps

  • R Shiny / Streamlit: Require an active R or Python process running on a server 24/7 to compute data, filter tables, and render graphics whenever a user clicks a button.
  • Dynamic Drought Module (DDM) on GitHub Pages: Has zero application backend.
    • All source TypeScript code is compiled down beforehand into static HTML, JavaScript, and CSS.
    • The map rendering engine (MapLibre GL JS) uses the visitor’s computer/phone GPU via WebGL.
    • Data layers are either pre-compiled into static vector tile archives (.pmtiles and .geojson in public/data/), streamed as remote Cloud-Optimized GeoTIFFs (COGs) via HTTP Range requests, or fetched directly from public REST endpoints (USGS stream gauges, NIFC wildfires, NOAA drought, BCWS).
    • GitHub Pages simply acts as a high-speed static file server (CDN) delivering those static files to the browser.

2. Fundamentals: Tooling Explained for Non-Node Developers

If you are unfamiliar with the Node.js and npm ecosystem, here is how each piece maps to concepts in Python or R:

Tool / Concept What it is Python Analogy R Analogy Role in this Project
Node.js JavaScript runtime engine outside the browser Python interpreter (python3) R executable (R) Runs build scripts, testing tools, and compilers on developers’ laptops and GitHub servers.
.nvmrc Node Version Manager config file .python-version (pyenv) .Rversion / renv.lock R version Enforces that everyone uses the exact pinned version of Node (24.20.0).
npm Node Package Manager pip + venv / poetry / uv install.packages() + renv Downloads third-party libraries and runs workflow scripts.
package.json Project manifest and task definition pyproject.toml / requirements.txt DESCRIPTION file Lists dependencies, licenses, and command-line scripts.
package-lock.json Cryptographic lockfile poetry.lock / requirements.lock renv.lock Locks the exact checksums and versions of every transitive dependency.
npm ci “Clean Install” command pip install --no-deps -r ... renv::restore() Strictly installs from package-lock.json without modifying it. Used in CI and automated builds.
npm run <name> Script runner make <task> or poetry run <task> devtools::check(), custom Makefile Executes scripts defined in the "scripts" block of package.json.
TypeScript (tsc) Statically typed JavaScript Python type hints (mypy) Static linters / type checkers Catches errors before runtime; compiled away during build.
Vite Modern frontend bundler & dev server Not typically used; like a fast webpack/Sphinx pkgdown / Quarto asset compiler Assembles TypeScript, stylesheets, and assets into an optimized dist/ bundle.
Playwright Browser automation test framework pytest-playwright / Selenium shinytest2 Boots a headless browser and verifies user clicks, map interactions, and accessibility.

3. Configuration Files in This Repository

1. .nvmrc

The single line 24.20.0 pins the exact patch release of Node.js Active LTS.

  • Developers use nvm use to switch to this version locally.
  • GitHub Actions reads this file with actions/setup-node (node-version-file: .nvmrc) so that cloud runners execute identical binaries.

2. package.json

Located at the root of the repository, this file organizes three crucial things:

  1. Engines: Requires node >= 24.0.0.
  2. Dependencies:
    • dependencies: Runtime libraries that ship into the user’s browser (e.g., maplibre-gl for maps, pmtiles for reading archived vector tiles, @preact/signals for UI reactivity).
    • devDependencies: Development-only tools that never get sent to the end user (e.g., typescript, vite, @playwright/test, mapshaper).
  3. Scripts: Command shortcuts executed via npm run <name>. Essential ones include:
    • npm run dev: Starts the local development server at http://localhost:5173.
    • npm run build: Runs TypeScript typechecking (tsc --noEmit) and invokes vite build.
    • npm run preview: Boots a local static HTTP server at http://localhost:4173 serving the built dist/ directory for production simulation.
    • npm run gate: Deterministic quality gate; builds dist/, checks bundle sizes and activation budgets, and runs all unit contracts.
    • npm run test:serial: Runs end-to-end browser tests via Playwright.

3. vite.config.ts

The configuration file for the Vite build tool. Key decisions implemented here:

  • base: './': Forces all asset links (scripts, CSS, images) to be relative rather than absolute (/). This allows the app to be hosted under a root domain, a GitHub Pages subfolder (e.g., /dynamic-drought-module/), or inside an iframe.
  • Build Stamping (DDM_BUILD_SHA and DDM_BUILD_NONCE): Injects the exact Git commit SHA and CI run identifier into the compiled HTML. When deployed, automated verification scripts read document.documentElement.dataset.ddmBuildSha to prove the live website actually runs the code that was merged.
  • Code Splitting (rolldownOptions): Isolates the heavy maplibre-gl (approx. 800 kB) and pmtiles libraries into dedicated chunks so browser caches preserve them across application updates.
  • outDir: 'dist': Instructs Vite to output the final website into the dist/ folder.

4. How the GitHub Actions Pipeline Deploys to GitHub Pages

The automated deployment pipeline is governed by files in .github/workflows/:

flowchart TD
    Push["Push to 'main' Branch<br/>(paths-ignore filters docs-only commits)"] --> Concurrency["Concurrency Gate<br/>group: pages, cancel-in-progress: true"]

    subgraph DeployWorkflow["deploy.yml (GitHub Actions)"]
        direction TB
        subgraph BuildJob["Job: build (Gate & Build)"]
            direction TB
            Setup["Set up Node.js 24.20.0 (.nvmrc) & npm ci"]
            Gate["Run 'npm run gate'<br/>• tsc --noEmit (typecheck)<br/>• vite build (outputs dist/)<br/>• Bundle size & activation budget checks<br/>• Contract & unit tests"]
            Strip["Run 'npm run strip:sourcemaps'<br/>Removes debug source maps"]
            UploadArtifact["actions/upload-pages-artifact<br/>Packages dist/ for Pages"]
            Setup --> Gate --> Strip --> UploadArtifact
        end

        subgraph BrowserJob["Job: browser (Advisory)"]
            direction TB
            Playwright["Playwright Browser Suite<br/>• 8 parallel shards<br/>• Non-blocking (advisory on main)<br/>• Reports failures to GitHub Issue"]
        end

        subgraph DeployJob["Job: deploy (Publish to Pages)"]
            direction TB
            HeadCheck["Confirm commit is still HEAD of main"]
            DeployPages["actions/deploy-pages<br/>• Writes to GitHub Pages CDN<br/>• Automatic 30s retry on transient error"]
            HeadCheck --> DeployPages
        end

        BuildJob -->|needs: build| DeployJob
        BuildJob -.->|parallel advisory| BrowserJob
    end

    subgraph VerifyWorkflow["verify-live.yml (Post-Deploy Proof)"]
        direction TB
        LiveProof["Probe Live Site<br/>• Verify live SHA & nonce match commit<br/>• Validate PMTiles byte-range requests<br/>• Run live browser smoke tests<br/>• File divergence issue if checks fail"]
    end

    Concurrency --> BuildJob
    DeployJob -->|workflow_run on success| VerifyWorkflow

Detailed Breakdown of Workflow Files

A. .github/workflows/deploy.yml

This is the primary deployment workflow. It triggers automatically when code lands on the main branch:

  1. Paths Ignore: It ignores edits to pure documentation files (like docs/**, *.md). Documentation updates do not alter code in dist/, avoiding unnecessary rebuilds.
  2. Concurrency Control: It specifies concurrency: group: pages, cancel-in-progress: true. If multiple commits land in quick succession, older in-progress builds are cancelled so only the newest commit is deployed, preventing race conditions on GitHub Pages.
  3. Least Privilege Security: The build job has read-only permissions (contents: read, pages: read). Only the specific deploy job is granted pages: write and id-token: write to authenticate with GitHub’s OpenID Connect (OIDC) token issuer.
  4. Build & Gate: It executes npm ci followed by npm run gate. If any TypeScript error, bundle size violation, or data inconsistency exists, the build halts and nothing is deployed. Once passing, npm run strip:sourcemaps removes debug source maps before packaging.
  5. Publish to Pages:
    • actions/configure-pages: Prepares GitHub Pages metadata.
    • actions/upload-pages-artifact: Packages dist/.
    • actions/deploy-pages: Publishes the packaged files directly to the GitHub Pages environment.

B. .github/workflows/verify-live.yml

A unique engineering practice in this repository is that merging a commit is not considered proof that the release succeeded.

  • Once deploy.yml succeeds, verify-live.yml wakes up.
  • It queries the public site (https://atniclimate.github.io/dynamic-drought-module/ or configured domain).
  • It verifies that the deployed commit SHA stamped on the page matches the repository SHA.
  • It tests that the web server properly handles HTTP Range requests (vital for MapLibre streaming .pmtiles vector tiles without downloading whole gigabyte files).
  • If divergence is detected, it automatically files a GitHub Issue alerting maintainers.

5. Local Developer Workflow: Running and Building Locally

If you want to test and run this application on your local machine:

1. Install Node.js

Ensure you have Node.js 24 installed. If you use nvm (Node Version Manager):

nvm install
nvm use

2. Install Project Dependencies

Run npm ci (rather than npm install) to ensure you install the exact versions locked in package-lock.json:

npm ci

3. Start the Interactive Local Development Server

npm run dev

Open http://localhost:5173 in your browser. Any change you make to TypeScript, HTML, or CSS files will immediately update in your browser using Hot Module Replacement (HMR).

4. Build and Preview the Production Site

To test the exact static output that will be uploaded to GitHub Pages:

# 1. Typecheck and build the static bundle into dist/
npm run build

# 2. Preview the built dist/ folder on a local production-style server
npm run preview

Visit http://localhost:4173.

5. Run the Deterministic Quality Gate

Before pushing changes to GitHub, run:

npm run gate

This executes the exact checks that the GitHub Actions deploy.yml workflow will run in the cloud.


6. Summary: The Lifecycle at a Glance

  1. Write Code: Developers edit TypeScript files in src/ and assets in public/.
  2. Typecheck & Bundle: npm run build runs tsc to verify type safety and vite build to generate static assets into dist/.
  3. Validate: npm run gate ensures bundle size, schemas, and contracts pass.
  4. Continuous Deployment: On push to main, GitHub Actions (deploy.yml) runs the gate, bundles dist/, and publishes it to GitHub Pages via actions/deploy-pages.
  5. Serve Client-Side: Users open the site in their browser. The client browser executes MapLibre GL JS, streams vector tiles, and pulls live environmental data directly without needing a custom application server.
  6. Live Verification: verify-live.yml probes the live site to ensure the deployed bytes, build SHA, and tile-range queries are healthy.

7. Architectural Variations Across Projects

I looked at several other projects by Patrick Freeland as to how they deployed a serverless website. For details, see byandell/pfGuides. Below are the prompts for an individual repo and for comparison across repos, which led to this section.

Prompt:

  • Using DocumentTools/github/serverless.html, explain concisely how this repo gets deployed to produce `https://atniclimate.github.io/[repo-name]/. Avoid duplication of content. Use mermaid for any flowchart.
  • The summaries in deploy/ other than TERRA.md show slightly different ways to deploy a serverless website. Suggest changes to ../DocumentTools/github/serverless.md, which was built from the dynamic-drought-module tool, to include these variations.

Response:

While the Dynamic Drought Module illustrates a full-scale Node.js/Vite CI pipeline, serverless static delivery on GitHub Pages accommodates several lighter or specialized architectures across the ATNI project portfolio — as well as clear boundaries for when a tool should remain local-only:

flowchart TD
    Start["How should the project be delivered?"] --> Q0{"Publish to the web?"}
    Q0 -->|No: Local Native Tool| Contrast["Contrast: Local-Only Binary<br/>(ocr-engine-next)<br/>• Native Rust CLI (cargo build)<br/>• Read-only CI sovereignty guard<br/>• No GitHub Pages deployment"]

    Q0 -->|Yes: GitHub Pages| Q1{"Requires build or compilation?"}

    Q1 -->|No: Pure Vanilla HTML/JS| Q1b{"Isolated publish root needed?"}
    Q1b -->|No: Native /docs| PatternA["Pattern A: Zero-Build Direct<br/>(TieredSovereignDataFramework)<br/>• Author in docs/<br/>• Deploy via main:/docs"]
    Q1b -->|Yes: Custom site/| PatternAPlus["Pattern A+: Zero-Build Isolated Root<br/>(TERRA)<br/>• Root .gitignore allowlist -> site/<br/>• Actions deploys path: site + .nojekyll"]

    Q1 -->|Yes| Q2{"Build engine & toolchain?"}

    Q2 -->|Python Tooling| Q3{"Deploy mechanism?"}
    Q3 -->|Native GitHub Pages| PatternB["Pattern B: Local Python Generator<br/>(climate-curriculum)<br/>• build.py, print_pdf.py, handout.py -> docs/<br/>• Deploy via main:/docs with .nojekyll"]
    Q3 -->|GitHub Actions CI Gate| PatternC["Pattern C: Gated Isolated Root<br/>(atni-task-force)<br/>• Local rebuild_all.py -> site/<br/>• CI runs validate_public.py + check.yml<br/>• Actions deploys path: site"]

    Q2 -->|Node / TypeScript / Bundler| Q4{"External API secrets or CORS required?"}
    Q4 -->|No: Public APIs / Static Tiles| PatternBase["Baseline: Full Cloud CI/CD<br/>(dynamic-drought-module)<br/>• CI runs gate + strip:sourcemaps -> dist/<br/>• actions/deploy-pages + verify-live"]
    Q4 -->|Yes: Gated Federal APIs| PatternD["Pattern D: Hybrid Edge Proxy<br/>(policy-sentinel)<br/>• Vite bundles into docs/ + SHA-256 shards<br/>• Cloudflare Worker proxies APIs"]

Pattern A: Zero-Build Direct Static Authoring (TieredSovereignDataFramework)

  • Reference: TieredSovereignDataFramework
  • Use Case: Lightweight analytical sites, interactive framework guides, or decision trees that do not require module bundling or transpilation.
  • Workflow: Authors write standard HTML5, CSS3, and ES6 JavaScript directly inside the docs/ folder (index.html, styles.css, app.js).
  • Deployment: Configured via native GitHub Pages settings pointing directly to the main branch /docs folder. No GitHub Actions workflows (.github/workflows/), npm dependencies, or build runners are involved (only Google Fonts are loaded externally for typography).
  • Benefits: Zero build latency, zero third-party JS build dependencies, and immediate updates upon push.

Pattern A+: Zero-Build Isolated Subdirectory via Actions (TERRA)

  • Reference: TERRA
  • Use Case: Rich static portfolio showcases or dashboards (“command decks”) with zero build step that still need strict separation between published assets and local planning/source materials.
  • Workflow:
    1. Pure HTML, CSS, vanilla JavaScript, self-hosted fonts, photography, and an offline gzipped CesiumJS 3D terrain viewer (DecompressionStream("gzip")) live inside site/ alongside site/.nojekyll (preserving underscore directories like site/iter/_kernel/).
    2. .gitignore uses an explicit root allowlist (/* ignored except site/, .github/, README.md, LICENSE*) so local planning docs, AI agent configs, and uncompressed photo sources never enter Git.
    3. External live apps (such as Policy Sentinel) are integrated via an opt-in lazy <iframe data-load="..."> that loads only on explicit user click.
  • Deployment: .github/workflows/pages.yml triggers on pushes to site/** and deploys path: site directly via actions/upload-pages-artifact and actions/deploy-pages without any Node or Python build step.
  • Benefits: Combines Pattern A’s zero-build simplicity with Pattern C’s isolated publication root.

Pattern B: Local Python Generation with Deterministic Quality Gates (climate-curriculum)

  • Reference: Climate Curriculum
  • Use Case: Educational or research modules where templates, vector graphics (e.g., SVG geometries), printable handouts, and static data are maintained with Python scripts.
  • Workflow:
    1. Developers compile editable templates (source/template.html) and geospatial data (source/columbia_svg.json) into docs/index.html using python source/build.py.
    2. Additional Python generators (python tools/print_pdf.py and python tools/handout.py, using headless Chrome and PyMuPDF) compile Markdown curriculum sources and source/handout/ assets into printable PDFs and HTML drafts under docs/downloads/ (while unapproved print drafts remain in git-ignored private/).
    3. Local deterministic checks (tools/check.py and Playwright tools/probe.js) run before committing to verify strict constraints: zero external network dependencies, ATNI editorial styles, layout responsiveness, and accessibility (a11y).
  • Deployment: Published via native GitHub Pages (main:/docs). The presence of docs/.nojekyll ensures GitHub Pages serves raw SVG, font, download, and image directories directly without Jekyll interference.
  • Benefits: Self-contained delivery that operates 100% offline (e.g., in tribal school classrooms or low-connectivity environments) with user state saved in browser localStorage.

Pattern C: Isolated Subdirectory with CI Boundary Gates (atni-task-force)

  • Reference: ATNI Task Force
  • Use Case: Multi-tier data projects where sensitive notes, planning documents, or raw registries must remain strictly segregated from public deliverables.
  • Workflow:
    1. Maintainers compile open claims locally using a Python script orchestrator (scripts/rebuild_all.py), generating static HTML, data plates, explorer blocks, and briefing PDFs into an isolated site/ folder.
    2. Before pushing, scripts/check_t1_leak.py scans site/ against local git-ignored Tier 1 documents (planning-T1/, work/, files-unsorted/) to block verbatim text leakage, while .github/workflows/check.yml runs read-only pytest unit tests on branches and PRs.
    3. Commits pushed to main trigger .github/workflows/pages.yml, which runs scripts/validate_public.py (Python 3.12 + pymupdf) to enforce schema compliance, link safety, and public-boundary rules.
    4. If all validation checks pass, actions/upload-pages-artifact packages only path: site (with include-hidden-files: true to preserve site/.nojekyll), and actions/deploy-pages publishes the bundle.
  • Benefits: Internal working files, planning drafts, build scripts, and tests remain segregated from the public web server with automated leak prevention.

Pattern D: Hybrid Static SPA with Serverless Edge Proxy (policy-sentinel)

  • Reference: Policy Sentinel
  • Use Case: Client-side interactive applications that require authenticated access to external APIs with secret keys, rate limits, or strict CORS policies (e.g., GovInfo, Congress.gov, Regulations.gov).
  • The Problem: GitHub Pages is purely client-side; embedding an API key in client JavaScript leaks the secret publicly to anyone inspecting browser network traffic.
  • The Solution:
    1. Frontend & Allowlist Gates: Running npm run demo:build executes finish-demo-build.mjs --build and check-pages-files.mjs. Vite (vite.demo.config.ts) builds with base: './' and emptyOutDir: false into docs/index.html and docs/demo-assets/, preserving pre-built static lookup shards in docs/demo-data/ (cfr/, usc/, vocab/, manifest.json, SHA-256-verified at runtime) and docs/source-reviews/. finish-demo-build.mjs packages licenses (docs/THIRD-PARTY-NOTICES.txt), validates shard hashes, verifies docs/.nojekyll, and prunes stale assets, while check-pages-files.mjs enforces an exact file allowlist across docs/.
    2. Edge Proxy: A read-only Cloudflare Worker (worker/wrangler.toml, deployed via npm run demo:worker:deploy) proxies allowlisted official hosts — both keyed api.data.gov services and unkeyed endpoints (Federal Register, Grants.gov, Washington State Legislature). It accepts POST /api/search JSON (keeping search terms out of URLs), injects DATA_GOV_API_KEY, enforces origin/CORS checks and dual rate limits (RATE per-IP and KEY_RATE shared), refuses HTTP redirects, and uses version-scoped caching (CF_VERSION_METADATA).
    3. Verification: A post-deployment browser audit (scripts/verify-demo-browser.mjs using playwright-core + pdftotext) tests the live URL for API/static request budgets, automated WCAG accessibility (axe), network boundaries, and PDF briefing export.

Contrast: When Not to Deploy to GitHub Pages (ocr-engine-next)

  • Reference: ocr-engine-next (private, source-available native Rust engine)
  • Use Case: Security-sensitive document processing or local-only native tooling where source documents must never leave a collaborator’s workstation and no public web surface is appropriate.
  • Workflow:
    1. Local Build Only: Authorized collaborators clone the repository and build locally (cargo build --workspace) with local PDFium (bin/pdfium.dll, SHA-256-verified via scripts/fetch_pdfium.ps1) and Tesseract 5, verifying workstation readiness with ocr-cli doctor and ocr-cli preflight.
    2. Read-Only CI Verification: GitHub Actions (.github/workflows/ci.yml with permissions: contents: read) publishes nothing. Instead, it runs a sovereignty guard (verifying every tracked document-like file matches pinned synthetic fixture digests) alongside Rust build, lint, test, and cargo deny check gates (mirrored locally via scripts/gates.ps1).
  • Takeaway: Not every repository with GitHub Actions belongs on GitHub Pages; the same CI gate and sovereignty-guard discipline applies cleanly to local-only native binaries.

Comparative Architecture Matrix

Dimension Baseline (dynamic-drought-module) Zero-Build (Tiered Sovereign Data Framework) Zero-Build Isolated (TERRA) Local Python (climate-curriculum) Gated Isolated Root (atni-task-force) Hybrid Edge Proxy (policy-sentinel) Local-Only Contrast (ocr-engine-next)
Primary Purpose High-performance interactive geospatial mapping Sovereign data framework guide & decision tool Static portfolio command deck & 3D terrain showcase Offline-capable climate education module & PDF handouts Regional energy & tech policy coordination library Federal policy intelligence & document analysis Private native document OCR engine
Source Directory src/ (TypeScript, SCSS) docs/ (Vanilla JS, CSS) site/ (Vanilla HTML/JS, offline CesiumJS) source/ (template.html, JSON), curriculum/*.md scripts/ & open data files demo/ (Preact, TypeScript) & worker/ crates/ (Rust workspace)
Build Toolchain Node.js, npm, Vite, tsc None (Zero build step) None (Zero build step) Python 3 (build.py, print_pdf.py, handout.py) Python 3 (rebuild_all.py) Vite (vite.demo.config.ts) + Wrangler Rust (cargo, clippy, cargo-deny) + PowerShell 7
Build Environment Cloud CI (GitHub Actions runner) None None Local workstation Local workstation Local workstation Local workstation only
Publishing Target Ephemeral dist/ Tracked docs/ Tracked site/ Tracked docs/ (index.html, downloads/, assets) Tracked site/ Tracked docs/ (index.html, demo-assets/, demo-data/) None (local native CLI binary)
Deployment Method GitHub Actions (deploy.yml + OIDC) Native Pages (main:/docs) GitHub Actions (pages.yml with path: site) Native Pages (main:/docs) GitHub Actions (pages.yml with path: site) Native Pages (main:/docs) + Cloudflare Worker Local source build (no web host)
Jekyll Bypass Handled by Actions artifact Handled automatically Required (site/.nojekyll) Required (docs/.nojekyll) Required (site/.nojekyll) Required (docs/.nojekyll) N/A
Quality & Security Gates CI: npm run gate + strip:sourcemaps None Root .gitignore allowlist Local: check.py & Playwright probe.js CI: validate_public.py + check.yml; Local: check_t1_leak.py Local: finish-demo-build.mjs & check-pages-files.mjs allowlist CI (read-only): sovereignty guard + Cargo/cargo-deny gates
Data & API Architecture Direct public APIs (USGS, NOAA, NIFC, BCWS), PMTiles & remote COGs Embedded static JSON & client-side DOM rendering Embedded JSON registry, gzipped 3D terrain & opt-in lazy <iframe> Inlined SVG geometry, static PDFs & browser localStorage Embedded JSON registry & static briefing PDFs SHA-256 static shards + Cloudflare Worker (POST /api/search, dual rate limits) 100% local files (banned network crates)
Post-Deploy Audit verify-live.yml (DOM SHA & HTTP Range tests) Manual browser inspection Manual browser inspection Local Playwright probe suite Local preview server inspection verify-demo-browser.mjs (budgets, axe WCAG, PDF export) Local ocr-cli doctor & ocr-cli preflight

Key Takeaways for Serverless Publishing

  1. Choosing Between Native /docs and GitHub Actions (actions/deploy-pages):
    • Use Native /docs if you prefer committing built static assets or zero-dependency files directly to Git. It provides instant deployments with zero CI runner minutes.
    • Use GitHub Actions (actions/deploy-pages) if you want to keep compiled artifacts out of Git history (e.g., ephemeral dist/), build on the cloud runner, isolate publishing to a custom folder (e.g., site/), or enforce automated quality/governance gates before publishing.
  2. Jekyll Bypass (.nojekyll) Hygiene:
    • GitHub Pages enables Jekyll processing by default, which ignores folders or filenames beginning with underscores (e.g., _assets/, _kernel/) or periods. Adding an empty .nojekyll file to the root of the published directory (docs/.nojekyll or site/.nojekyll) ensures that all assets serve as intended.
  3. Managing Secrets in Serverless Frontends:
    • A static frontend hosted on GitHub Pages cannot securely hold confidential API keys; any key included in client JavaScript is visible to visitors.
    • When private APIs or strict CORS endpoints are necessary, pair the static frontend with a serverless edge worker (such as Cloudflare Workers or AWS Lambda@Edge) that injects credentials, enforces origin/rate limits, and manages caching before forwarding data to the browser.
  4. Data Governance & Boundary Enforcement:
    • In open repositories containing multiple tiers of sensitivity (such as the Tiered Sovereign Data Framework), use isolated publishing directories (site/) or root .gitignore allowlists coupled with automated pre-deploy boundary scripts (validate_public.py, check_t1_leak.py, check-pages-files.mjs) to ensure internal drafts, community notes, or unredacted files are never deployed to public CDNs.
  5. Knowing When Not to Publish to the Web:
    • For private or high-sensitivity local workflows (like ocr-engine-next), keep execution strictly local as a native binary and restrict GitHub Actions to read-only CI (permissions: contents: read) with automated sovereignty guards.

This site uses Just the Docs, a documentation theme for Jekyll.