pcbjam/site
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Istvan Matejcsok 1b08a5eb06 feat(editor): report uncaught errors to Better Stack
The editor reported nothing when a session died. Evidence lived only in-tab —
an 800-line React array behind a "Show console" button — so diagnosis meant
asking a user to paste a screenshot.

Better Stack's Error Tracking ingests the Sentry wire protocol, so this runs
the stock @sentry/browser against a Better Stack DSN. Sentry.init installs its
own window error/unhandledrejection handlers, so uncaught main-thread errors
and the wasm traps that escape emscripten's DOM event handlers are captured
with no instrumentation at the throw sites. Not their JS tag: it has no
beforeSend or fingerprint hooks, its runtime spawns workers from cross-origin
CDN hosts (this page is COEP: require-corp), and it ships session replay on by
default — which on a CAD canvas records customers' board geometry.

@sentry/browser is imported in exactly one file so the vendor stays swappable,
mirroring how lib/analytics.ts isolates Plausible.

Also replaces the terminal-signature regex with a shared, unit-tested predicate
(wasm/terminal-error.ts) used by BOTH the fatal overlay and the reporter, so
they cannot disagree. The regex was a type check written as a string match and
had three live holes: `RuntimeError` was listed but never appears IN
`.message`; Chrome's bare "unreachable" and "null function" matched nothing
(the v0.1.20 prod log is exactly those); and narrowing "table index is out of
bounds" to `\bindex out of bounds` for Firefox in 197f317 silently stopped
matching Chrome's spelling. Checking the TYPE — every trap in this family is a
WebAssembly.RuntimeError — covers all engines and ends the spelling chase; the
message patterns remain as a fallback for paths that lose the Error object,
such as a worker ErrorEvent crossing the realm boundary with error: null.
197f317's pthread-worker tap, promote() and Firefox findings are kept as-is.

Notes:
- Off unless VITE_ERRORS_DSN is set AND VITE_ALLOW_USER_OVERRIDE !== "1" (dev
  servers and every Playwright harness set the latter, and production builds
  never do), so a production DSN in a local .env still cannot report. With no
  DSN the whole SDK is const-folded out: 1,193,080 vs 1,282,463 bytes of JS.
- browserApiErrors integration removed. It wraps setTimeout/rAF/addEventListener
  in try/catch, which is exactly how KiCad-on-Emscripten drives its main loop.
- Console breadcrumbs off (collab/debug.ts's clog fires per Yjs update and would
  evict the ring before any crash); dom/fetch/navigation breadcrumbs kept.
- beforeSend redacts token/apiKey/Bearer — collab/provider.ts puts the collab
  token in the y-partyserver URL, so a connection-failure string carries a live
  credential — and guards the cascade: one wedge produced 8 errors in prod, and
  after the first terminal event the rest are dropped into cascade_count.

Verified end to end against the real EU host from a cross-origin-isolated page:
POST /api/<id>/envelope/ -> 200, and 4 terminal throws produce 1 event
(control: 1 throw, same count).

Privacy policy 9, cookie policy 6 and the licenses page are updated: Better
Stack is disclosed as an EU processor, and the licenses page now describes the
browser app's own JS dependencies, which it never did.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 12:24:30 +02:00
..
brand feat(site): 🫙 PCBJam landing revisions — branding, accuracy, positioning graphic 2026-06-07 17:14:19 +02:00
functions feat(site): move the marketing site from Vercel to Cloudflare Pages 2026-07-27 13:41:51 +02:00
public feat(site): move the marketing site from Vercel to Cloudflare Pages 2026-07-27 13:41:51 +02:00
src feat(editor): report uncaught errors to Better Stack 2026-08-03 12:24:30 +02:00
test feat(site): move the marketing site from Vercel to Cloudflare Pages 2026-07-27 13:41:51 +02:00
.dev.vars.example feat(site): move the marketing site from Vercel to Cloudflare Pages 2026-07-27 13:41:51 +02:00
.gitignore feat(site): move the marketing site from Vercel to Cloudflare Pages 2026-07-27 13:41:51 +02:00
astro.config.mjs feat(deploy/site): serve the apex from the same Pages project, no redirect rule 2026-07-27 14:34:16 +02:00
package-lock.json feat(site): move the marketing site from Vercel to Cloudflare Pages 2026-07-27 13:41:51 +02:00
package.json feat(site): move the marketing site from Vercel to Cloudflare Pages 2026-07-27 13:41:51 +02:00
postcss.config.mjs feat(site): 🛬 PCBJam landing page — waitlist, sections, Tailwind 2026-06-07 14:59:13 +02:00
README.md chore(deploy/site): retire the migration scaffolding, keep the health check 2026-07-27 15:08:56 +02:00
tsconfig.json feat(site): move the marketing site from Vercel to Cloudflare Pages 2026-07-27 13:41:51 +02:00
vitest.config.ts harden the marketing site: gate demo overrides, rate-limit + redact waitlist 2026-07-16 12:46:17 +02:00
wrangler.toml chore(deploy/site): retire the migration scaffolding, keep the health check 2026-07-27 15:08:56 +02:00

site

Public-facing marketing/content site for the KiCad WebAssembly project: landing page, blog, and legal pages. Built with Astro 6.

This is a standalone project — it is intentionally decoupled from the /web app monorepo (which is the product itself: React frontend + Fastify backend). It uses npm (not the monorepo's pnpm) and has its own package-lock.json.

What it ships

  • Static by default: every page is prerendered to HTML and ships zero client JavaScript. A visitor downloads HTML + CSS only — no React/JS bundle.
  • No adapter and no server bundle: the build emits dist/ only. The single dynamic endpoint, /api/waitlist, ships as a Cloudflare Pages Function from functions/ (see below).

Routes

Route Source
/ src/pages/index.astro
/blog src/pages/blog/index.astro
/blog/<id> src/pages/blog/[slug].astro
/terms src/pages/terms.astro
/privacy src/pages/privacy.astro
/cookies src/pages/cookies.astro

Blog posts are Markdown files in src/content/blog/, validated by the schema in src/content.config.ts. Add a post by dropping a new .md file there with title, description, and pubDate frontmatter.

Local development

Requires Node ≥ 22.12 (Astro 6 requirement).

cd site
npm install
npm run dev        # http://localhost:4321
npm run build      # outputs to dist/ (static only — no adapter)
npm run preview    # serve the production build locally

Dynamic routes

Every page is static. The one server-side endpoint is a Cloudflare Pages Function, not an Astro SSR route:

functions/api/waitlist.ts   ->  POST/OPTIONS/GET  /api/waitlist

Pages maps the functions/ tree to routes by path, and the handlers are named exports (onRequestPost, onRequestOptions, onRequestGet). Config arrives on context.env, not via astro:env/server. public/_routes.json restricts Function invocation to /api/*, so every page and asset stays a plain static request.

To add another endpoint, drop a new file in functions/ — no Astro adapter and no prerender = false involved.

Locally, run the built site the way Pages will serve it (this is the only way to exercise the Function, astro dev does not run functions/):

cp .dev.vars.example .dev.vars   # fill in as needed; gitignored
npm run build
npm run pages:dev                # http://localhost:8788

Deploying

www.pcbjam.com is a Cloudflare Pages project (pcbjam-site), deployed by .github/workflows/deploy-site.yml on every push to main touching site/** — content and blog posts do not wait for a release tag.

push to main (site/**)  ->  npm ci  ->  npm test  ->  astro build
                        ->  wrangler pages deploy  ->  www.pcbjam.com

Two things live outside the repo and are set once:

  • Secrets — wrangler pages secret put <NAME> --project-name pcbjam-site for RESEND_API_KEY, RESEND_SEGMENT_ID, WAITLIST_FROM_EMAIL. WAITLIST_ALLOWED_ORIGINS is deliberately unset; it keeps the in-code default.
  • The custom domain — attached to the Pages project (there is no wrangler pages domain subcommand). The apex pcbjam.com 308s to www via a Cloudflare Redirect Rule.

Response headers come from public/_headers (copied verbatim into dist/), which carries the COOP/COEP rules the embedded Gerber viewer needs. Do not widen them to /* — the landing page must stay un-isolated so the YouTube hero embed loads.

One-time setup, the invariants that fail silently if changed, and the health check (deploy/site/verify.sh) are in ../deploy/site/README.md.