🏗️ Next.js to Cloudflare Edge Architecture
When deploying the dashboard, the monorepo uses@opennextjs/cloudflare to convert standard Node.js server-side features into Edge-compliant JavaScript:
- Server Isolate (
.open-next/worker.js): Handles Server-Side Rendering (SSR), React Server Components (RSC) hydration, API routes, and cookies encryption. - Static Assets (
.open-next/assets/): Houses all static assets, which are bound to the worker via ASSETS bindings to serve static pages at sub-millisecond CDN latency.
⚡ 1. Declared Wrangler Configurations & Bindings
The dashboard’swrangler.jsonc maps out its internal service links to extract D1 databases metrics and agent status updates:
🔑 2. Environmental Variables & Encrypted Secrets
DASHBOARD_USER&DASHBOARD_PASS: Administrative credentials required to access the visual panel.SESSION_SECRET: A secure 32-character encryption key used to cryptographically sign session cookies at the edge.INTERNAL_KEY_BINDING: Shared key used to validate calls to thed1-workerandagent-workerservice bindings.
Local Development Mocking (.env.local)
Create a gitignored .env.local file inside workers/dashboard/ for local Next.js runs:
🎛️ 3. Schema-Driven Settings System
To allow operators to extend the platform’s settings without touching React code, the dashboard implements a schema-driven configuration manager parsed dynamically fromconfig.schema.json:
Form Submission Flow
- When you save the settings form, the Next.js server actions intercept the payload.
- The server action iterates over the JSON schema keys and writes the values
directly to the bound
CONFIG_KVnamespace. - The changes propagate globally to your edge executors in under 10 seconds.
🚢 4. Production Build & Rollout Runbook
To compile and deploy the Next.js dashboard to Cloudflare:🛡️ Security Headers
The dashboard applies 7 security headers on every response via the shared@jango-blockchained/hoox-shared/middleware secureHeaders() factory:
Headers are applied via the
withSecurityHeaders() wrapper in src/middleware.ts, covering all return paths including static files, login pages, CSRF errors, and auth failures.
🔗 Next Steps
- Security Testing & Hardening — Auth hardening, security tests, and CI/CD scanning.
- agent-worker Profile — Review AI chat streaming and risk evaluation structures.
- d1-worker Profile — Check REST schemas that feed database metrics to the dashboard.