- Replace ShaderGradientBackground WebGL shader (3 static spheres) with pure CSS radial-gradient divs — moves from ClientProviders (deferred JS) to app/layout.tsx as a server component rendered in initial HTML. Eliminates @shadergradient/react, three, @react-three/fiber from the JS bundle. Removes chunks/7001 (~20s CPU eval) and the 39s main thread block. - Remove optimizeCss/critters: it was converting <link rel="stylesheet"> to a JS-deferred preload, which PageSpeed read as a 410ms sequential CSS chain. Both CSS files now load as parallel <link> tags from initial HTML (~150ms). - Update browserslist safari >= 15 → 15.4 (Array.prototype.at, Object.hasOwn are native in 15.4+; eliminates unnecessary SWC compatibility transforms). - Delete orphaned app/styles/ghostContent.css (never imported anywhere, 3.7KB). - Add .claude/ dev team setup: 5 subagents (frontend-dev, backend-dev, tester, code-reviewer, debugger), 3 skills (/add-section, /review-changes, /check-quality), 3 path-scoped rules, settings.json with auto-lint hook. - Update CLAUDE.md with server/client orchestrator pattern, SSR animation safety rules, API route conventions, and improved command reference. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.0 KiB
1.0 KiB
paths
| paths | |
|---|---|
|
API Route Rules
Every API route in this project must follow these conventions:
Required exports
export const runtime = 'nodejs'
export const dynamic = 'force-dynamic'
Response format
All responses must include a source field:
return NextResponse.json({ data: ..., source: 'directus' | 'fallback' | 'error' })
Error handling
- Wrap all external calls (Directus, n8n, Redis, PostgreSQL) in try/catch
- Return graceful fallback data on failure — never let an external service crash the page
- Error logging:
if (process.env.NODE_ENV === "development") console.error(...)
n8n proxies (app/api/n8n/)
- Rate limiting required on all public endpoints (use
lib/auth.ts) - 10 second timeout on upstream n8n calls
- Auth via
N8N_SECRET_TOKENand/orN8N_API_KEYheaders
Directus queries
- Use
directusRequest()fromlib/directus.ts - 2 second timeout is already set in
directusRequest() - Always have a hardcoded fallback when Directus returns null