{"_id":"@ai-domain-data/nextjs","name":"@ai-domain-data/nextjs","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"@ai-domain-data/nextjs","version":"0.1.1","description":"Next.js integration for the AI Domain Data Standard. Add domain-profile.json to your Next.js site with App Router or Pages Router support.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"},"./app-router":{"import":"./dist/app-router.js","types":"./dist/app-router.d.ts"},"./pages-router":{"import":"./dist/pages-router.js","types":"./dist/pages-router.d.ts"},"./generate":{"import":"./dist/generate.js","types":"./dist/generate.d.ts"}},"scripts":{"build":"tsc -p tsconfig.json","prepublishOnly":"npm run build","test":"echo \"Tests coming soon\""},"keywords":["ai-domain-data","aidd","domain-profile","nextjs","next.js","app-router","pages-router","api-route","schema","validation"],"author":{"name":"AI Domain Data Standard Contributors"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ai-domain-data/spec.git","directory":"packages/nextjs"},"dependencies":{"ajv":"^8.12.0","ajv-formats":"^2.1.1"},"devDependencies":{"@types/node":"^20.11.30","next":"^14.0.0","typescript":"^5.4.5"},"peerDependencies":{"next":">=13.0.0","react":">=18.0.0"},"engines":{"node":">=18.17.0"},"_id":"@ai-domain-data/nextjs@0.1.1","gitHead":"cbd73ff430ac68685e9cc816a70be7ba3e2e0c28","bugs":{"url":"https://github.com/ai-domain-data/spec/issues"},"homepage":"https://github.com/ai-domain-data/spec#readme","_nodeVersion":"18.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-UQg5dILkAdHZdqjXnCpgEadeoEODP2NaohSxGk5e/gqLf/HwUwScVizH6Emm7obU9ntYTMFxBEq9AKRkcXTZuw==","shasum":"63ac4ece74620ac1a8e4cf44521ff7a7caa27d3c","tarball":"https://registry.npmjs.org/@ai-domain-data/nextjs/-/nextjs-0.1.1.tgz","fileCount":25,"unpackedSize":22428,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGJNWzPP7wYR37TIuhaQJMr3jhmH1Fn1nG8mCs9CAExXAiEAn4ai6REDpxJ/ft7PhyZYMKpJxMAu0Eg7PyNqwocf2y8="}]},"_npmUser":{"name":"dylanl37","email":"info@ascendingwebservices.com"},"directories":{},"maintainers":[{"name":"dylanl37","email":"info@ascendingwebservices.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nextjs_0.1.1_1763656717747_0.24209037465631256"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-20T16:38:37.653Z","0.1.1":"2025-11-20T16:38:37.952Z","modified":"2025-11-20T16:38:38.249Z"},"maintainers":[{"name":"dylanl37","email":"info@ascendingwebservices.com"}],"description":"Next.js integration for the AI Domain Data Standard. Add domain-profile.json to your Next.js site with App Router or Pages Router support.","homepage":"https://github.com/ai-domain-data/spec#readme","keywords":["ai-domain-data","aidd","domain-profile","nextjs","next.js","app-router","pages-router","api-route","schema","validation"],"repository":{"type":"git","url":"git+https://github.com/ai-domain-data/spec.git","directory":"packages/nextjs"},"author":{"name":"AI Domain Data Standard Contributors"},"bugs":{"url":"https://github.com/ai-domain-data/spec/issues"},"license":"MIT","readme":"# @ai-domain-data/nextjs\r\n\r\nNext.js integration for the [AI Domain Data Standard](https://ai-domain-data.org). Add `domain-profile.json` to your Next.js site with support for both App Router and Pages Router.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @ai-domain-data/nextjs\r\n```\r\n\r\n## Quick Start\r\n\r\n### App Router (Next.js 13+)\r\n\r\nCreate `app/.well-known/domain-profile.json/route.ts`:\r\n\r\n```typescript\r\nimport { createAIDomainDataRoute } from \"@ai-domain-data/nextjs/app-router\";\r\n\r\nexport const GET = createAIDomainDataRoute({\r\n  useEnv: true,\r\n});\r\n```\r\n\r\n### Pages Router (Next.js 12 and below)\r\n\r\nCreate `pages/api/.well-known/domain-profile.json.ts`:\r\n\r\n```typescript\r\nimport { createAIDomainDataHandler } from \"@ai-domain-data/nextjs/pages-router\";\r\n\r\nexport default createAIDomainDataHandler({\r\n  useEnv: true,\r\n});\r\n```\r\n\r\n### Environment Variables\r\n\r\nAdd to `.env.local` (quotes are optional and will be automatically stripped):\r\n\r\n```\r\nNEXT_PUBLIC_SITE_NAME=Your Site Name\r\nNEXT_PUBLIC_SITE_DESCRIPTION=Your site description\r\nNEXT_PUBLIC_SITE_URL=https://yoursite.com\r\nNEXT_PUBLIC_SITE_CONTACT=contact@yoursite.com\r\nNEXT_PUBLIC_ENTITY_TYPE=Organization\r\nNEXT_PUBLIC_SITE_LOGO=https://yoursite.com/logo.png\r\n```\r\n\r\n**Note:** Quotes around values are optional. If you include them, they will be automatically removed. Values with spaces work fine without quotes.\r\n\r\nThat's it! Your domain profile will be available at `https://yoursite.com/.well-known/domain-profile.json`.\r\n\r\n## Configuration Options\r\n\r\n### Using Environment Variables (Recommended)\r\n\r\nThe package automatically reads from environment variables:\r\n\r\n```typescript\r\nexport const GET = createAIDomainDataRoute({\r\n  useEnv: true, // default\r\n});\r\n```\r\n\r\nEnvironment variables:\r\n- `NEXT_PUBLIC_SITE_NAME` or `SITE_NAME` - Site name\r\n- `NEXT_PUBLIC_SITE_DESCRIPTION` or `SITE_DESCRIPTION` - Site description\r\n- `NEXT_PUBLIC_SITE_URL` or `SITE_URL` - Website URL\r\n- `NEXT_PUBLIC_SITE_CONTACT` or `SITE_CONTACT` - Contact email/URL\r\n- `NEXT_PUBLIC_SITE_LOGO` or `SITE_LOGO` - Logo URL (optional)\r\n- `NEXT_PUBLIC_ENTITY_TYPE` or `ENTITY_TYPE` - Entity type (optional)\r\n\r\n### Using Config Object\r\n\r\nProvide configuration directly:\r\n\r\n```typescript\r\nexport const GET = createAIDomainDataRoute({\r\n  config: {\r\n    name: \"My Site\",\r\n    description: \"A great website\",\r\n    website: \"https://example.com\",\r\n    contact: \"hello@example.com\",\r\n    entity_type: \"Organization\",\r\n    logo: \"https://example.com/logo.png\",\r\n  },\r\n  cacheMaxAge: 3600, // optional, default: 3600 seconds\r\n});\r\n```\r\n\r\n### Custom Cache Settings\r\n\r\nControl caching behavior:\r\n\r\n```typescript\r\nexport const GET = createAIDomainDataRoute({\r\n  useEnv: true,\r\n  cacheMaxAge: 7200, // 2 hours\r\n});\r\n```\r\n\r\n## API Reference\r\n\r\n### App Router\r\n\r\n#### `createAIDomainDataRoute(options?)`\r\n\r\nCreates a Next.js App Router route handler for `/.well-known/domain-profile.json`.\r\n\r\n**Options:**\r\n- `config?: AIDomainDataConfig` - Direct configuration object\r\n- `useEnv?: boolean` - Use environment variables (default: `true`)\r\n- `cacheMaxAge?: number` - Cache max age in seconds (default: `3600`)\r\n\r\n**Returns:** Route handler function compatible with App Router.\r\n\r\n**Example:**\r\n```typescript\r\nimport { createAIDomainDataRoute } from \"@ai-domain-data/nextjs/app-router\";\r\n\r\nexport const GET = createAIDomainDataRoute({\r\n  useEnv: true,\r\n});\r\n```\r\n\r\n### Pages Router\r\n\r\n#### `createAIDomainDataHandler(options?)`\r\n\r\nCreates a Next.js Pages Router API handler for `/.well-known/domain-profile.json`.\r\n\r\n**Options:**\r\n- `config?: AIDomainDataConfig` - Direct configuration object\r\n- `useEnv?: boolean` - Use environment variables (default: `true`)\r\n- `cacheMaxAge?: number` - Cache max age in seconds (default: `3600`)\r\n\r\n**Returns:** API route handler compatible with Pages Router.\r\n\r\n**Example:**\r\n```typescript\r\nimport { createAIDomainDataHandler } from \"@ai-domain-data/nextjs/pages-router\";\r\n\r\nexport default createAIDomainDataHandler({\r\n  useEnv: true,\r\n});\r\n```\r\n\r\n### Utilities\r\n\r\n#### `generateAIDomainData(config)`\r\n\r\nGenerate a validated AI Domain Data payload from a configuration object.\r\n\r\n```typescript\r\nimport { generateAIDomainData } from \"@ai-domain-data/nextjs\";\r\n\r\nconst payload = generateAIDomainData({\r\n  name: \"My Site\",\r\n  description: \"Description\",\r\n  website: \"https://example.com\",\r\n  contact: \"contact@example.com\",\r\n});\r\n```\r\n\r\n#### `validateAIDomainData(data)`\r\n\r\nValidate data against the AI Domain Data Standard schema.\r\n\r\n```typescript\r\nimport { validateAIDomainData } from \"@ai-domain-data/nextjs\";\r\n\r\nconst result = validateAIDomainData(data);\r\nif (!result.valid) {\r\n  console.error(result.errors);\r\n}\r\n```\r\n\r\n## TypeScript Support\r\n\r\nFull TypeScript support is included. Types are exported from the main package:\r\n\r\n```typescript\r\nimport type { AIDomainDataConfig, AIDomainDataPayload } from \"@ai-domain-data/nextjs\";\r\n```\r\n\r\n## Validation\r\n\r\nThe package automatically validates your configuration against the AI Domain Data Standard v0.1.1 schema. Invalid configurations will throw errors with detailed messages to help you fix issues.\r\n\r\n## Entity Types\r\n\r\nThe `entity_type` field must be one of the following schema.org values:\r\n\r\n- `Organization`\r\n- `Person`\r\n- `Blog`\r\n- `NGO`\r\n- `Community`\r\n- `Project`\r\n- `CreativeWork`\r\n- `SoftwareApplication`\r\n- `Thing`\r\n\r\n## Examples\r\n\r\nSee the `examples/` directory for complete working examples for both App Router and Pages Router.\r\n\r\n## Requirements\r\n\r\n- Next.js 13.0.0 or higher\r\n- React 18.0.0 or higher\r\n- Node.js 18.17.0 or higher\r\n\r\n## Related Packages\r\n\r\n- `@ai-domain-data/cli` - Command-line tool for validation and generation\r\n- `@ai-domain-data/resolver` - TypeScript SDK for resolving domain profiles\r\n\r\n## Links\r\n\r\n- [AI Domain Data Standard](https://ai-domain-data.org)\r\n- [GitHub Repository](https://github.com/ai-domain-data/spec)\r\n- [Documentation](https://github.com/ai-domain-data/spec/tree/main/packages/nextjs)\r\n\r\n## License\r\n\r\nMIT\r\n\r\n","readmeFilename":"README.md","_rev":"1-b087e72fd671e464e258b8c61b8822c8"}