Next.js Adapter
@vhyxseal/nextjs provides a Next.js config plugin, manifest and dashboard route handlers, and server component utilities. It auto-injects the /__agent__/manifest.json and /__agent__/dashboard.json rewrites — no manual routing configuration required.
What the Adapter Provides
- vhyxsealPlugin() — wraps next.config.ts to auto-inject rewrites and cache headers
- handleManifestRoute() — route handler for app/api/vhyxseal-manifest/route.ts
- handleDashboardRoute() — route handler for app/api/vhyxseal-dashboard/route.ts
- getSealManifest() — fetch manifest in React Server Components
Installation
Next.js ≥ 14 supported. App Router and Pages Router both covered.
Full Setup
SealProvider in Next.js
SealProvider uses React Context and must be in a Client Component. Wrap it in a ClientProviders component and import it from a Server Component layout.
vhyxsealPlugin() Options
Currently accepts an empty options object. Future versions will add customization for the rewrite destination and header values. Plugin auto-injects both manifest and dashboard rewrites with independent duplicate guards — if you already have a rewrite for the canonical URL, the plugin leaves it unchanged.
Server Component Utilities
TypeScript Types
Common Patterns
App Router — complete setup
Pages Router setup
Known Limitations
- Underscore route constraint (DECISION-028): Next.js ignores route segments starting with underscore. The
__agent__directory cannot be used as a direct Next.js route. The plugin auto-injects a rewrite to solve this — the canonical URL/__agent__/manifest.jsonworks correctly for agents getSealManifest()fetches over HTTP — not available during static export (next export). Use in dynamic routes only- SealProvider must be in a Client Component — use a ClientProviders wrapper pattern in App Router
- The nextjs package exports dual CJS/ESM (DECISION-027) — it is consumed inside
next.config.tswhich is compiled to CommonJS by Next.js