Migrate logicsrc-web from Vite SPA to Next.js 16 App Router

Replaces the Vite single-page app + custom Node server.js with a Next.js
16.2.6 App Router app.

- proxy.ts (src/proxy.ts): www.logicsrc.com -> logicsrc.com 301 over https,
  preserving path + query (the original request, now via Next 16 Proxy).
- One SSR page via an optional catch-all ([[...slug]]) that renders the same
  marketing/spec page for each known top-level route (/docs, /blog, /openspec,
  ...) and 404s unknown paths, preserving existing canonical URLs. Markup is a
  faithful server-rendered port of the old main.ts (SEO upgrade over the prior
  client render); interactivity (hire-us form, CoinPay button, section scroll)
  moves to a client component.
- API routes ported to app/api/**: hire-us coinpay-checkout + project-request,
  oauth/coinpay start/callback/session, webhooks/coinpay. Shared logic in
  src/lib/coinpay.ts (eligibility, payment-rail selection, webhook verify,
  HMAC session sign/verify, cookies).
- commandboard-api (/health + /api/boards|tasks|plugins/*) is no longer mounted
  in-process; next.config.ts proxies those paths to COMMANDBOARD_API_URL via
  afterFiles rewrites (our own /api routes match first).
- Build/start switch to next build / next start. Contract tests rewritten to
  exercise proxy.ts, the route handlers, and pure helpers directly (21 passing);
  Playwright webServer updated.

Deployment (Railway): set COMMANDBOARD_API_URL to the commandboard-api service
URL and run it as its own service; root start now runs next start.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-06-07 03:41:48 +00:00
parent cf5d526176
commit f0a9f3890e
24 changed files with 2102 additions and 1394 deletions

View file

@ -1,23 +1,27 @@
{
"name": "@logicsrc/web",
"version": "0.1.0",
"description": "LogicSRC standards and open specification PWA.",
"type": "module",
"private": true,
"description": "LogicSRC standards and open specification PWA (Next.js).",
"scripts": {
"build": "node scripts/check-assets.js && vite build",
"dev": "vite --host 0.0.0.0",
"start": "node server.js",
"dev": "next dev -p 5174",
"build": "next build",
"start": "next start",
"test": "vitest run contract",
"test:contract": "vitest run contract",
"test:e2e": "playwright test"
},
"dependencies": {
"@logicsrc/commandboard-api": "file:../commandboard-api",
"typescript": "^5.9.3",
"vite": "^7.2.6"
"next": "16.2.6",
"react": "19.2.0",
"react-dom": "19.2.0"
},
"devDependencies": {
"@playwright/test": "^1.57.0",
"@types/node": "^24.10.1",
"@types/react": "^19.2.0",
"@types/react-dom": "^19.2.0",
"typescript": "^5.9.3",
"vitest": "^4.0.8"
}
}