{"_id":"@ai-growth/nextjs","_rev":"4-7f8bc2d2b407f54a0f6b453a3f699c73","name":"@ai-growth/nextjs","dist-tags":{"latest":"1.3.1"},"versions":{"1.0.0":{"name":"@ai-growth/nextjs","version":"1.0.0","keywords":["nextjs","sanity","cms","blog","routing","typescript","react"],"author":{"name":"AI Growth Team"},"license":"MIT","_id":"@ai-growth/nextjs@1.0.0","maintainers":[{"name":"jaime-aigrowth","email":"jaime@aigrowthagent.co"},{"name":"jaimeflneto","email":"jaimeflneto@gmail.com"}],"homepage":"https://github.com/ai-growth/nextjs#readme","bugs":{"url":"https://github.com/ai-growth/nextjs/issues"},"dist":{"shasum":"d4b9a6b50872d3a5e540afca8aad0eee1474f41a","tarball":"https://registry.npmjs.org/@ai-growth/nextjs/-/nextjs-1.0.0.tgz","fileCount":169,"integrity":"sha512-/cmX3XyVsknsUH63RLhbjDX/ZREqVU3evPk6AWiwoxCwMc/nw4Uuoj2B/yRH2fEBoqruEvONbGWFCbgri2kF5w==","signatures":[{"sig":"MEUCIHH+e2K3G4FZNsUHMD0gu2qQmpKM3YUAgKwWoRcQV8wJAiEA3wAJODqlsYhsjOzBlRPw6UTDhUzAgRXp9vLITHtwtYE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1013865},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=16.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"a08531320909bfc953cf2ed2936e54ac85cd67e4","scripts":{"dev":"tsc --watch","lint":"eslint src --ext .ts,.tsx --fix","test":"jest","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"rm -rf dist","format":"prettier --write \"src/**/*.{ts,tsx,json,md}\"","prepare":"husky","test:ci":"jest --coverage --watchAll=false","build:cjs":"tsc --project tsconfig.cjs.json && cp dist/cjs/index.js dist/index.cjs && cp dist/cjs/index.d.ts dist/index.cjs.d.ts","build:esm":"tsc","lint:check":"eslint src --ext .ts,.tsx","test:watch":"jest --watch","format:check":"prettier --check \"src/**/*.{ts,tsx,json,md}\"","test:coverage":"jest --coverage","prepublishOnly":"echo 'Skipping build for now'"},"_npmUser":{"name":"jaimeflneto","email":"jaimeflneto@gmail.com"},"repository":{"url":"git+https://github.com/ai-growth/nextjs.git","type":"git"},"_npmVersion":"10.8.2","description":"Seamlessly integrate Sanity CMS with Next.js applications for automated blog routing and rendering","directories":{},"lint-staged":{"src/**/*.{ts,tsx}":["eslint --fix","prettier --write","npm run test:ci"],"src/**/*.{json,md}":["prettier --write"]},"sideEffects":false,"_nodeVersion":"20.18.3","dependencies":{"zod":"^3.25.55","@sanity/client":"^6.29.1","@sanity/image-url":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.7","eslint":"^8.57.1","ts-jest":"^29.3.4","prettier":"^3.5.3","@eslint/js":"^9.28.0","typescript":"^5.0.0","@types/jest":"^29.5.14","@types/node":"^20.0.0","lint-staged":"^16.1.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","eslint-plugin-react":"^7.37.5","@testing-library/react":"^16.3.0","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","jest-environment-jsdom":"^30.0.0-beta.3","@testing-library/jest-dom":"^6.6.3","@typescript-eslint/parser":"^8.33.1","eslint-plugin-react-hooks":"^5.2.0","@testing-library/user-event":"^14.6.1","@typescript-eslint/eslint-plugin":"^8.33.1"},"peerDependencies":{"next":">=12.0.0","react":">=17.0.0","react-dom":">=17.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs_1.0.0_1749421626093_0.39836648608884584","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@ai-growth/nextjs","version":"1.1.0","keywords":["nextjs","sanity","cms","blog","routing","typescript","react"],"author":{"name":"AI Growth Team"},"license":"MIT","_id":"@ai-growth/nextjs@1.1.0","maintainers":[{"name":"jaime-aigrowth","email":"jaime@aigrowthagent.co"},{"name":"jaimeflneto","email":"jaimeflneto@gmail.com"}],"homepage":"https://github.com/ai-growth/nextjs#readme","bugs":{"url":"https://github.com/ai-growth/nextjs/issues"},"dist":{"shasum":"9bb076d5f1a0c7da70bc5036ec97107e393cf387","tarball":"https://registry.npmjs.org/@ai-growth/nextjs/-/nextjs-1.1.0.tgz","fileCount":169,"integrity":"sha512-egYZLnLqx4bvKe/z3MUMIAW7gNyDJma0YPBXYSKTXdLs5iT4UwlZmXyx0NhgHWsxjN+6HJ9XpVR5J66Ih6MR+w==","signatures":[{"sig":"MEQCIANSj6WqfGgi6adXcS6r3DSIYkZ4k7iGz/UN4sOtHhNPAiBO8wmEp/Ot3N9yPASL3DaNDH+CbyG1lr5TMlOv2UVEtQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1018999},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=16.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"a7cafd614fe0852b0277f64686a3139044ac446f","scripts":{"dev":"tsc --watch","lint":"eslint src --ext .ts,.tsx --fix","test":"jest","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"rm -rf dist","format":"prettier --write \"src/**/*.{ts,tsx,json,md}\"","prepare":"husky","test:ci":"jest --coverage --watchAll=false","build:cjs":"tsc --project tsconfig.cjs.json && cp dist/cjs/index.js dist/index.cjs && cp dist/cjs/index.d.ts dist/index.cjs.d.ts","build:esm":"tsc","lint:check":"eslint src --ext .ts,.tsx","test:watch":"jest --watch","format:check":"prettier --check \"src/**/*.{ts,tsx,json,md}\"","test:coverage":"jest --coverage","prepublishOnly":"echo 'Skipping build for now'"},"_npmUser":{"name":"jaimeflneto","email":"jaimeflneto@gmail.com"},"repository":{"url":"git+https://github.com/ai-growth/nextjs.git","type":"git"},"_npmVersion":"11.4.1","description":"Seamlessly integrate Sanity CMS with Next.js applications for automated blog routing and rendering","directories":{},"lint-staged":{"src/**/*.{ts,tsx}":["eslint --fix","prettier --write","npm run test:ci"],"src/**/*.{json,md}":["prettier --write"]},"sideEffects":false,"_nodeVersion":"23.11.1","dependencies":{"zod":"^3.25.55","@sanity/client":"^6.29.1","@sanity/image-url":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.7","eslint":"^8.57.1","ts-jest":"^29.3.4","prettier":"^3.5.3","@eslint/js":"^9.28.0","typescript":"^5.0.0","@types/jest":"^29.5.14","@types/node":"^20.0.0","lint-staged":"^16.1.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","eslint-plugin-react":"^7.37.5","@testing-library/react":"^16.3.0","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","jest-environment-jsdom":"^30.0.0-beta.3","@testing-library/jest-dom":"^6.6.3","@typescript-eslint/parser":"^8.33.1","eslint-plugin-react-hooks":"^5.2.0","@testing-library/user-event":"^14.6.1","@typescript-eslint/eslint-plugin":"^8.33.1"},"peerDependencies":{"next":">=12.0.0","react":">=17.0.0","react-dom":">=17.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs_1.1.0_1749830207705_0.4654739461393056","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@ai-growth/nextjs","version":"1.3.0","keywords":["nextjs","sanity","cms","blog","routing","typescript","react"],"author":{"name":"AI Growth Team"},"license":"MIT","_id":"@ai-growth/nextjs@1.3.0","maintainers":[{"name":"jaime-aigrowth","email":"jaime@aigrowthagent.co"},{"name":"jaimeflneto","email":"jaimeflneto@gmail.com"}],"homepage":"https://github.com/ai-growth/nextjs#readme","bugs":{"url":"https://github.com/ai-growth/nextjs/issues"},"dist":{"shasum":"4861b8126c0b8f3394776d8268e441cf2b2da886","tarball":"https://registry.npmjs.org/@ai-growth/nextjs/-/nextjs-1.3.0.tgz","fileCount":170,"integrity":"sha512-7LxCZcKvOWh5RuRhrVGWVMZsRUtMgAmDTPJlIaTmFrJHJheDTxCkRvJBGykGmefaE6L6LyHNEN2W5qXj/MOebw==","signatures":[{"sig":"MEYCIQDSh0bWTFPZnpPlM19R198hOMvlluLt9ATq4AqHzkH8zwIhAMAAXhI9ZSl+Ri2dmX1+ckxWwXyKvCFzyauwOBlYvWjH","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1000956},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=16.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"4e5a64c09a0238b01db685cc83a4b50380daa625","scripts":{"dev":"tsc --watch","lint":"eslint src --ext .ts,.tsx --fix","test":"jest","build":"npm run clean && npm run build:esm && npm run build:cjs","clean":"rm -rf dist","format":"prettier --write \"src/**/*.{ts,tsx,json,md}\"","prepare":"husky","test:ci":"jest --coverage --watchAll=false","build:cjs":"tsc --project tsconfig.cjs.json && cp dist/cjs/index.js dist/index.cjs && cp dist/cjs/index.d.ts dist/index.cjs.d.ts","build:esm":"tsc","lint:check":"eslint src --ext .ts,.tsx","test:watch":"jest --watch","format:check":"prettier --check \"src/**/*.{ts,tsx,json,md}\"","test:coverage":"jest --coverage","prepublishOnly":"echo 'Skipping build due to TypeScript errors - manual build required'"},"_npmUser":{"name":"jaimeflneto","email":"jaimeflneto@gmail.com"},"repository":{"url":"git+https://github.com/ai-growth/nextjs.git","type":"git"},"_npmVersion":"11.4.1","description":"Seamlessly integrate Sanity CMS with Next.js applications for automated blog routing and rendering","directories":{},"lint-staged":{"src/**/*.{ts,tsx}":["eslint --fix","prettier --write","npm run test:ci"],"src/**/*.{json,md}":["prettier --write"]},"sideEffects":false,"_nodeVersion":"23.11.1","dependencies":{"zod":"^3.25.55","@sanity/client":"^6.29.1","@sanity/image-url":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^9.1.7","eslint":"^8.57.1","ts-jest":"^29.3.4","prettier":"^3.5.3","@eslint/js":"^9.28.0","typescript":"^5.0.0","@types/jest":"^29.5.14","@types/node":"^20.0.0","lint-staged":"^16.1.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","identity-obj-proxy":"^3.0.0","eslint-plugin-react":"^7.37.5","jest-transform-stub":"^2.0.0","@testing-library/react":"^16.3.0","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","jest-environment-jsdom":"^30.0.0-beta.3","@testing-library/jest-dom":"^6.6.3","@typescript-eslint/parser":"^8.33.1","eslint-plugin-react-hooks":"^5.2.0","@testing-library/user-event":"^14.6.1","@typescript-eslint/eslint-plugin":"^8.33.1"},"peerDependencies":{"next":">=12.0.0","react":">=17.0.0","react-dom":">=17.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nextjs_1.3.0_1750112172197_0.6154417596286603","host":"s3://npm-registry-packages-npm-production"}},"1.3.1":{"name":"@ai-growth/nextjs","version":"1.3.1","description":"Seamlessly integrate Sanity CMS with Next.js applications for automated blog routing and rendering","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"scripts":{"build":"npm run clean && npm run build:esm && npm run build:cjs","build:esm":"tsc","build:cjs":"tsc --project tsconfig.cjs.json && cp dist/cjs/index.js dist/index.cjs && cp dist/cjs/index.d.ts dist/index.cjs.d.ts","dev":"tsc --watch","clean":"rm -rf dist","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","test:ci":"jest --coverage --watchAll=false","lint":"eslint src --ext .ts,.tsx --fix","lint:check":"eslint src --ext .ts,.tsx","format":"prettier --write \"src/**/*.{ts,tsx,json,md}\"","format:check":"prettier --check \"src/**/*.{ts,tsx,json,md}\"","prepare":"husky","prepublishOnly":"echo 'Skipping build due to TypeScript errors - manual build required'"},"keywords":["nextjs","sanity","cms","blog","routing","typescript","react"],"author":{"name":"AI Growth Team"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ai-growth/nextjs.git"},"bugs":{"url":"https://github.com/ai-growth/nextjs/issues"},"homepage":"https://github.com/ai-growth/nextjs#readme","engines":{"node":">=16.0.0"},"peerDependencies":{"next":">=12.0.0","react":">=17.0.0","react-dom":">=17.0.0"},"devDependencies":{"@eslint/js":"^9.28.0","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.6.1","@types/jest":"^29.5.14","@types/node":"^20.0.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@typescript-eslint/eslint-plugin":"^8.33.1","@typescript-eslint/parser":"^8.33.1","eslint":"^8.57.1","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.4.1","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","husky":"^9.1.7","identity-obj-proxy":"^3.0.0","jest":"^29.7.0","jest-environment-jsdom":"^30.0.0-beta.3","jest-transform-stub":"^2.0.0","lint-staged":"^16.1.0","prettier":"^3.5.3","ts-jest":"^29.3.4","typescript":"^5.0.0"},"dependencies":{"@sanity/client":"^6.29.1","@sanity/image-url":"^1.0.0","zod":"^3.25.55"},"lint-staged":{"src/**/*.{ts,tsx}":["eslint --fix","prettier --write","npm run test:ci"],"src/**/*.{json,md}":["prettier --write"]},"sideEffects":false,"_id":"@ai-growth/nextjs@1.3.1","gitHead":"33ef4e985a9d67fe961a93ebd9d9587701934345","_nodeVersion":"23.11.1","_npmVersion":"11.4.1","dist":{"integrity":"sha512-PeMzIpm8O9fWvp4/ZkslkKAT87aoHWFwzIN8EJj5ngHIgsHwLAG6bLdke4AfloOCrcCbp1Ik+XjPpSUYSmYiEw==","shasum":"75a7b9917ac9e02d607406379fd1c911a51bbaf9","tarball":"https://registry.npmjs.org/@ai-growth/nextjs/-/nextjs-1.3.1.tgz","fileCount":343,"unpackedSize":2004173,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCLDr00RwXrIXlzAPvusX8t0epre76mj0DogeHYaXT27wIhAN+/KhfQ3S/zAT0sq4nQtdyCseBfBf3QsN9VFRgLIo1Y"}]},"_npmUser":{"name":"jaimeflneto","email":"jaimeflneto@gmail.com","actor":{"name":"jaimeflneto","email":"jaimeflneto@gmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"jaime-aigrowth","email":"jaime@aigrowthagent.co"},{"name":"jaimeflneto","email":"jaimeflneto@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nextjs_1.3.1_1750899630986_0.39836641370749604"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-08T22:27:05.989Z","modified":"2025-06-26T01:00:31.410Z","1.0.0":"2025-06-08T22:27:06.340Z","1.1.0":"2025-06-13T15:56:48.008Z","1.3.0":"2025-06-16T22:16:12.488Z","1.3.1":"2025-06-26T01:00:31.184Z"},"bugs":{"url":"https://github.com/ai-growth/nextjs/issues"},"author":{"name":"AI Growth Team"},"license":"MIT","homepage":"https://github.com/ai-growth/nextjs#readme","keywords":["nextjs","sanity","cms","blog","routing","typescript","react"],"repository":{"type":"git","url":"git+https://github.com/ai-growth/nextjs.git"},"description":"Seamlessly integrate Sanity CMS with Next.js applications for automated blog routing and rendering","maintainers":[{"name":"jaime-aigrowth","email":"jaime@aigrowthagent.co"},{"name":"jaimeflneto","email":"jaimeflneto@gmail.com"}],"readme":"# @ai-growth/nextjs\n\n[![npm version](https://badge.fury.io/js/@ai-growth%2Fnextjs.svg)](https://badge.fury.io/js/@ai-growth%2Fnextjs)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)\n[![Next.js](https://img.shields.io/badge/Next.js-12%2B-black)](https://nextjs.org/)\n\n> **Enterprise-grade Sanity CMS integration for Next.js with advanced SEO, performance optimization, and developer experience**\n\n## 🚀 Overview\n\n`@ai-growth/nextjs` is a production-ready npm package that provides seamless integration between Sanity CMS and Next.js applications. It offers enterprise-level features including advanced SEO optimization, performance caching, lazy loading, comprehensive error handling, and responsive image optimization.\n\n**✨ Key Features:**\n- 🚀 **Rapid Setup**: Zero-config integration with intelligent defaults\n- 🔄 **Automatic Routing**: Dynamic `/cms/<slug>` route handling\n- 🎨 **Customizable Templates**: Advanced template system with lazy loading\n- 📱 **Responsive Design**: Mobile-first, accessible, SEO-optimized\n- 🔧 **TypeScript First**: Complete type safety and IntelliSense support\n- ⚡ **Performance Optimized**: Multi-layer caching, code splitting, image optimization\n- 🛡️ **Error Resilient**: Comprehensive error boundaries and fallback systems\n- 🔍 **SEO Ready**: Automatic meta tags, structured data, social media optimization\n- 📊 **Developer Experience**: Rich debugging tools and performance monitoring\n- 🔓 **Optional API Token**: No token needed for public data queries (CDN optimized)\n- 🌍 **Flexible Environment Variables**: Works with or without NEXT_PUBLIC_ prefix\n\n## 📦 Installation\n\n```bash\nnpm install @ai-growth/nextjs\n# or\nyarn add @ai-growth/nextjs\n# or\npnpm add @ai-growth/nextjs\n```\n\n### Required Peer Dependencies\n\n```bash\nnpm install next@>=12.0.0 react@>=17.0.0 react-dom@>=17.0.0\n```\n\n### Optional Dependencies\n\nFor enhanced features:\n\n```bash\n# For image optimization\nnpm install @sanity/image-url\n\n# For advanced caching (already included)\n# npm install @sanity/client\n```\n\n## 🚀 Quick Start\n\n### 1. Environment Setup\n\nCreate `.env.local` in your project root:\n\n```env\n# Required - Sanity Configuration\nSANITY_PROJECT_ID=your_project_id\nSANITY_DATASET=production\nSANITY_API_TOKEN=your_api_token\nSANITY_API_VERSION=2023-05-03\n\n# Optional - Routing Configuration\nCMS_ROUTE_PATH=/cms/\n\n# Optional - Performance Configuration\nENABLE_CACHE=true\nCACHE_TTL=300\n```\n\n### 2. Basic Integration\n\n**App Router (Next.js 13+)**\n\n```tsx\n// app/layout.tsx\nimport { CmsProvider } from '@ai-growth/nextjs';\n\nexport default function RootLayout({\n  children,\n}: {\n  children: React.ReactNode;\n}) {\n  return (\n    <html lang=\"en\">\n      <body>\n        <CmsProvider>\n          {children}\n        </CmsProvider>\n      </body>\n    </html>\n  );\n}\n\n// app/[[...slug]]/page.tsx\nimport { CmsRouteHandler } from '@ai-growth/nextjs';\n\nexport default function DynamicPage() {\n  return (\n    <CmsRouteHandler>\n      <div>This content shows for non-CMS routes</div>\n    </CmsRouteHandler>\n  );\n}\n```\n\n**Pages Router (Next.js 12+)**\n\n```tsx\n// pages/_app.tsx\nimport { CmsProvider } from '@ai-growth/nextjs';\nimport type { AppProps } from 'next/app';\n\nexport default function MyApp({ Component, pageProps }: AppProps) {\n  return (\n    <CmsProvider>\n      <Component {...pageProps} />\n    </CmsProvider>\n  );\n}\n\n// pages/[[...slug]].tsx\nimport { CmsRouteHandler } from '@ai-growth/nextjs';\n\nexport default function CatchAllPage() {\n  return (\n    <CmsRouteHandler>\n      <div>Fallback content for non-CMS routes</div>\n    </CmsRouteHandler>\n  );\n}\n```\n\n### 3. Advanced Configuration\n\n```tsx\n// lib/cms-config.ts\nimport { CmsConfig } from '@ai-growth/nextjs';\n\nexport const cmsConfig: CmsConfig = {\n  // Sanity Configuration\n  projectId: process.env.SANITY_PROJECT_ID!,\n  dataset: process.env.SANITY_DATASET!,\n  apiToken: process.env.SANITY_API_TOKEN,\n  apiVersion: process.env.SANITY_API_VERSION || '2023-05-03',\n  \n  // Routing Configuration\n  routePath: process.env.CMS_ROUTE_PATH || '/cms/',\n  \n  // Performance Configuration\n  cache: {\n    enabled: process.env.ENABLE_CACHE === 'true',\n    ttl: parseInt(process.env.CACHE_TTL || '300'),\n    staleTime: 300000, // 5 minutes\n    strategy: 'stale-while-revalidate'\n  },\n  \n  // SEO Configuration\n  seo: {\n    siteName: 'My Awesome Site',\n    defaultDescription: 'Welcome to our content hub',\n    twitterHandle: '@myhandle',\n    defaultImage: '/og-image.png'\n  }\n};\n\n// pages/_app.tsx or app/layout.tsx\nimport { CmsProvider } from '@ai-growth/nextjs';\nimport { cmsConfig } from '../lib/cms-config';\n\nexport default function MyApp({ Component, pageProps }: AppProps) {\n  return (\n    <CmsProvider config={cmsConfig}>\n      <Component {...pageProps} />\n    </CmsProvider>\n  );\n}\n```\n\n## 🎨 Template System\n\n### Using Default Templates\n\nThe package includes responsive, accessible templates:\n\n```tsx\nimport { DefaultTemplate, SimpleDefaultTemplate } from '@ai-growth/nextjs';\n\n// Automatic template selection based on content type\n<CmsRouteHandler />\n\n// Explicit template usage\n<DefaultTemplate content={content} />\n<SimpleDefaultTemplate content={content} />\n```\n\n### Custom Templates\n\n```tsx\n// components/MyCustomTemplate.tsx\nimport { TemplateProps, CmsImage, SEOHead } from '@ai-growth/nextjs';\n\nexport function MyCustomTemplate({ content }: TemplateProps) {\n  return (\n    <>\n      <SEOHead content={content} />\n      <article className=\"max-w-4xl mx-auto px-4\">\n        <header>\n          <h1 className=\"text-4xl font-bold\">{content.title}</h1>\n          {content.mainImage && (\n            <CmsImage\n              image={content.mainImage}\n              alt={content.title}\n              priority\n              className=\"w-full h-64 object-cover rounded-lg\"\n            />\n          )}\n        </header>\n        <main>\n          <ContentBody content={content.content} />\n        </main>\n      </article>\n    </>\n  );\n}\n\n// Register custom template\nimport { registerTemplate } from '@ai-growth/nextjs';\n\nregisterTemplate('custom', MyCustomTemplate);\n```\n\n### Lazy Loading Templates\n\n```tsx\nimport { \n  DynamicTemplateLoader,\n  LazyDefaultTemplateV2,\n  preloadTemplate \n} from '@ai-growth/nextjs';\n\n// Dynamic template loading with preloading\n<DynamicTemplateLoader \n  templateName=\"default-v2\"\n  preloadOnHover={true}\n  content={content}\n/>\n\n// Manual preloading\nuseEffect(() => {\n  preloadTemplate('default-v2');\n}, []);\n```\n\n## 🔍 SEO Optimization\n\n### Automatic SEO\n\nSEO optimization is automatic with smart defaults:\n\n```tsx\nimport { SEOHead, useSEOData } from '@ai-growth/nextjs';\n\n// Automatic SEO for CMS content\n<CmsRouteHandler /> // SEO included automatically\n\n// Manual SEO control\nfunction MyPage({ content }) {\n  return (\n    <>\n      <SEOHead \n        content={content}\n        siteName=\"My Site\"\n        defaultDescription=\"Amazing content\"\n      />\n      <main>{/* Your content */}</main>\n    </>\n  );\n}\n\n// Access SEO data in components\nfunction MySEOComponent() {\n  const seoData = useSEOData();\n  return <div>Page title: {seoData.title}</div>;\n}\n```\n\n### Advanced SEO Configuration\n\n```tsx\nimport { processSEO, generateStructuredData } from '@ai-growth/nextjs';\n\n// Custom SEO processing\nconst seoData = processSEO(content, {\n  siteName: 'My Site',\n  defaultImage: '/default-og.png',\n  twitterHandle: '@mysite',\n  customSchema: {\n    '@type': 'BlogPosting',\n    publisher: {\n      '@type': 'Organization',\n      name: 'My Company'\n    }\n  }\n});\n\n// Generate structured data\nconst structuredData = generateStructuredData(content, 'article');\n```\n\n## 🚀 Performance Features\n\n### Multi-Layer Caching\n\n```tsx\nimport { \n  CacheProvider, \n  useCmsContentCached,\n  CacheManager \n} from '@ai-growth/nextjs';\n\n// Global cache configuration\n<CacheProvider \n  config={{\n    strategy: 'stale-while-revalidate',\n    ttl: 300000, // 5 minutes\n    storage: ['memory', 'localStorage', 'indexedDB']\n  }}\n>\n  <App />\n</CacheProvider>\n\n// Use cached content hooks\nfunction MyComponent() {\n  const { \n    data, \n    loading, \n    error, \n    stale, \n    revalidating,\n    cacheHit \n  } = useCmsContentCached('posts', 'my-slug');\n  \n  return (\n    <div>\n      {loading && <LoadingSkeleton />}\n      {error && <ErrorBoundary error={error} />}\n      {data && <ContentDisplay content={data} />}\n      {stale && <div>Updating content...</div>}\n    </div>\n  );\n}\n\n// Manual cache operations\nconst cacheManager = CacheManager.getInstance();\nawait cacheManager.invalidateByTag('posts');\n```\n\n### Image Optimization\n\n```tsx\nimport { \n  OptimizedImage, \n  CmsImage, \n  ResponsiveImage,\n  HeroImage,\n  AvatarImage \n} from '@ai-growth/nextjs';\n\n// Sanity image with optimization\n<CmsImage\n  image={content.mainImage}\n  alt=\"Hero image\"\n  width={800}\n  height={600}\n  priority // Above the fold\n  quality={90}\n/>\n\n// Responsive images\n<ResponsiveImage\n  image={content.image}\n  aspectRatio=\"16:9\"\n  sizes=\"(max-width: 768px) 100vw, 50vw\"\n/>\n\n// Specialized image components\n<HeroImage image={heroImage} /> {/* Optimized for LCP */}\n<AvatarImage image={authorImage} size=\"lg\" /> {/* User avatars */}\n```\n\n### Lazy Loading & Code Splitting\n\n```tsx\nimport { \n  LazyLoadComponent,\n  IntersectionWrapper,\n  createLazyComponent,\n  useIntersectionObserver \n} from '@ai-growth/nextjs';\n\n// Lazy load below-the-fold content\n<LazyLoadComponent\n  loader={() => import('./HeavyComponent')}\n  fallback={<ContentSkeleton />}\n  rootMargin=\"100px\"\n/>\n\n// Intersection-based rendering\n<IntersectionWrapper placeholder={<div>Loading...</div>}>\n  <ExpensiveComponent />\n</IntersectionWrapper>\n\n// Custom lazy loading\nconst LazyComponent = createLazyComponent(\n  () => import('./MyComponent'),\n  { \n    fallback: <LoadingSkeleton />,\n    retryAttempts: 3 \n  }\n);\n\n// Custom intersection observer\nfunction MyComponent() {\n  const [ref, isVisible] = useIntersectionObserver({\n    threshold: 0.1,\n    rootMargin: '50px'\n  });\n  \n  return (\n    <div ref={ref}>\n      {isVisible && <ExpensiveContent />}\n    </div>\n  );\n}\n```\n\n## 🛡️ Error Handling\n\n### Error Boundaries\n\n```tsx\nimport { \n  ErrorBoundary, \n  CmsErrorBoundary,\n  ApiErrorBoundary,\n  withErrorBoundary \n} from '@ai-growth/nextjs';\n\n// Wrap components with error boundaries\n<ErrorBoundary\n  fallback={<ErrorPage />}\n  onError={(error, errorInfo) => console.error(error)}\n>\n  <MyComponent />\n</ErrorBoundary>\n\n// CMS-specific error handling\n<CmsErrorBoundary>\n  <CmsContent />\n</CmsErrorBoundary>\n\n// HOC pattern\nconst SafeComponent = withErrorBoundary(MyComponent, {\n  fallback: <div>Something went wrong</div>\n});\n```\n\n### Error Logging\n\n```tsx\nimport { \n  ErrorLogger, \n  logError, \n  logCriticalError \n} from '@ai-growth/nextjs';\n\n// Automatic error logging (configured in CmsProvider)\n// Errors are automatically categorized and sent to monitoring\n\n// Manual error logging\ntry {\n  // risky operation\n} catch (error) {\n  logError(error, {\n    category: 'api',\n    severity: 'error',\n    context: { userId: 'user123' }\n  });\n}\n\n// Critical errors\nlogCriticalError(new Error('Payment failed'), {\n  context: { orderId: 'order-123' }\n});\n```\n\n### Fallback Content\n\n```tsx\nimport { \n  FallbackContent, \n  ContentFallback,\n  useFallbackContent \n} from '@ai-growth/nextjs';\n\n// Provider with fallback content\n<FallbackContentProvider>\n  <App />\n</FallbackContentProvider>\n\n// Component with fallback\n<ContentFallback\n  type=\"post\"\n  fallbackTitle=\"Content Unavailable\"\n  fallbackMessage=\"This content is temporarily unavailable.\"\n  showRetry\n  onRetry={() => window.location.reload()}\n/>\n\n// Hook for fallback content\nfunction MyComponent() {\n  const { getFallbackContent } = useFallbackContent();\n  \n  const fallback = getFallbackContent('post', 'Unable to load post');\n  return <div>{fallback}</div>;\n}\n```\n\n## 🎣 Hooks & Context\n\n### Content Hooks\n\n```tsx\nimport { \n  useCmsContent,\n  useCmsContentList,\n  useCmsContentCached,\n  useContentPreload \n} from '@ai-growth/nextjs';\n\n// Fetch single content\nconst { data, loading, error } = useCmsContent('posts', slug);\n\n// Fetch content list\nconst { data: posts, loading } = useCmsContentList('posts', {\n  limit: 10,\n  sort: 'publishedAt desc'\n});\n\n// Cached content (recommended)\nconst { data, stale, revalidating } = useCmsContentCached('posts', slug);\n\n// Preload content\nconst preloadPost = useContentPreload();\npreloadPost('posts', 'upcoming-post-slug');\n```\n\n### CMS Context\n\n```tsx\nimport { useCms, useCmsTheme, useCmsTemplate } from '@ai-growth/nextjs';\n\nfunction MyComponent() {\n  const { config, client, isConnected } = useCms();\n  const theme = useCmsTheme();\n  const { currentTemplate, setTemplate } = useCmsTemplate();\n  \n  return (\n    <div className={theme.container}>\n      Status: {isConnected ? 'Connected' : 'Disconnected'}\n      Template: {currentTemplate}\n    </div>\n  );\n}\n```\n\n### Cache Context\n\n```tsx\nimport { \n  useCacheMetrics, \n  useCacheOperations,\n  useCacheDebug \n} from '@ai-growth/nextjs';\n\nfunction CacheDebug() {\n  const { hitRatio, size, responseTime } = useCacheMetrics();\n  const { invalidate, clear } = useCacheOperations();\n  const debugInfo = useCacheDebug();\n  \n  return (\n    <div>\n      <p>Hit Ratio: {hitRatio}%</p>\n      <p>Cache Size: {size} entries</p>\n      <p>Avg Response: {responseTime}ms</p>\n      <button onClick={() => clear()}>Clear Cache</button>\n    </div>\n  );\n}\n```\n\n## 📱 Loading States\n\n```tsx\nimport { \n  LoadingFallback,\n  CmsLoadingFallback,\n  Skeleton,\n  ContentSkeleton,\n  useLoading \n} from '@ai-growth/nextjs';\n\n// Pre-built loading components\n<LoadingFallback message=\"Loading content...\" />\n<CmsLoadingFallback contentType=\"article\" />\n\n// Skeleton components\n<Skeleton width={200} height={20} />\n<ContentSkeleton />\n\n// Loading state management\nfunction MyComponent() {\n  const { isLoading, setLoading } = useLoading();\n  \n  const handleSubmit = async () => {\n    setLoading(true);\n    try {\n      await submitData();\n    } finally {\n      setLoading(false);\n    }\n  };\n  \n  return (\n    <button onClick={handleSubmit} disabled={isLoading}>\n      {isLoading ? 'Submitting...' : 'Submit'}\n    </button>\n  );\n}\n```\n\n## 🔧 Configuration Options\n\n### Complete Configuration\n\n```tsx\ninterface CmsConfig {\n  // Sanity Configuration\n  projectId: string;\n  dataset: string;\n  apiToken?: string;\n  apiVersion?: string;\n  useCdn?: boolean;\n  \n  // Routing Configuration\n  routePath?: string;\n  baseUrl?: string;\n  \n  // Performance Configuration\n  cache?: {\n    enabled?: boolean;\n    ttl?: number;\n    staleTime?: number;\n    strategy?: 'cache-first' | 'network-first' | 'stale-while-revalidate';\n    storage?: ('memory' | 'localStorage' | 'sessionStorage' | 'indexedDB')[];\n  };\n  \n  // SEO Configuration\n  seo?: {\n    siteName?: string;\n    defaultDescription?: string;\n    defaultImage?: string;\n    twitterHandle?: string;\n    facebookAppId?: string;\n  };\n  \n  // Error Handling Configuration\n  errorHandling?: {\n    enableLogging?: boolean;\n    enableRetry?: boolean;\n    maxRetries?: number;\n    retryDelay?: number;\n  };\n  \n  // Image Configuration\n  images?: {\n    quality?: number;\n    formats?: ('webp' | 'avif' | 'jpeg' | 'png')[];\n    breakpoints?: { [key: string]: number };\n  };\n  \n  // Development Configuration\n  debug?: boolean;\n  logLevel?: 'error' | 'warn' | 'info' | 'debug';\n}\n```\n\n### Environment Variables\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `SANITY_PROJECT_ID` | ✅ | - | Sanity project ID |\n| `SANITY_DATASET` | ✅ | - | Sanity dataset name |\n| `SANITY_API_TOKEN` | ❌ | - | API token for private content (optional for public data) |\n| `SANITY_API_VERSION` | ❌ | `2023-05-03` | Sanity API version |\n| `CMS_ROUTE_PATH` | ❌ | `/cms/` | URL pattern for CMS pages |\n| `ENABLE_CACHE` | ❌ | `true` | Enable caching system |\n| `CACHE_TTL` | ❌ | `300` | Cache TTL in seconds |\n| `ENABLE_DEBUG` | ❌ | `false` | Enable debug mode |\n| `LOG_LEVEL` | ❌ | `error` | Logging level |\n\n### Next.js Public Variables (Client-side Access)\n\nFor client-side access, use the `NEXT_PUBLIC_` prefixed versions:\n\n| Variable | Description |\n|----------|-------------|\n| `NEXT_PUBLIC_SANITY_PROJECT_ID` | Client-accessible project ID |\n| `NEXT_PUBLIC_SANITY_DATASET` | Client-accessible dataset name |\n| `NEXT_PUBLIC_SANITY_API_VERSION` | Client-accessible API version |\n| `NEXT_PUBLIC_CMS_ROUTE_PATH` | Client-accessible route path |\n\n> **Security Note**: Never use `NEXT_PUBLIC_SANITY_API_TOKEN` as API tokens should never be exposed to the client.\n\n## 🎯 API Reference\n\n### Components\n\n#### Core Components\n- `CmsProvider` - Main provider component\n- `CmsRouteHandler` - Route handling component\n- `DefaultTemplate` - Default content template\n- `SimpleDefaultTemplate` - Minimal content template\n\n#### SEO Components\n- `SEOHead` - Complete SEO head component\n- `SafeSEOHead` - Error-resilient SEO component\n- `BasicSEO` - Minimal SEO component\n- `StructuredDataOnly` - JSON-LD only component\n\n#### Image Components\n- `OptimizedImage` - Base optimized image\n- `CmsImage` - Sanity-specific image\n- `ResponsiveImage` - Responsive image component\n- `HeroImage` - Above-the-fold optimized\n- `AvatarImage` - User avatar component\n\n#### Error Components\n- `ErrorBoundary` - Base error boundary\n- `CmsErrorBoundary` - CMS-specific errors\n- `ApiErrorBoundary` - API error handling\n- `NotFoundPage` - 404 error page\n- `ServerErrorPage` - 500 error page\n\n#### Loading Components\n- `LoadingFallback` - Generic loading component\n- `CmsLoadingFallback` - CMS loading states\n- `Skeleton` - Skeleton placeholder\n- `ContentSkeleton` - Content-specific skeleton\n\n#### Lazy Loading Components\n- `LazyLoadComponent` - Intersection-based lazy loading\n- `DynamicTemplateLoader` - Dynamic template loading\n- `IntersectionWrapper` - Viewport-based rendering\n\n### Hooks\n\n#### Content Hooks\n- `useCmsContent(type, slug)` - Fetch single content\n- `useCmsContentList(type, options)` - Fetch content list\n- `useCmsContentCached(type, slug)` - Cached content fetching\n- `useContentPreload()` - Content preloading\n\n#### Context Hooks\n- `useCms()` - CMS context access\n- `useCmsTheme()` - Theme context\n- `useCmsTemplate()` - Template context\n- `useCacheMetrics()` - Cache performance metrics\n- `useCacheOperations()` - Cache operations\n- `useSEOData()` - SEO data access\n\n#### Utility Hooks\n- `useLoading()` - Loading state management\n- `useIntersectionObserver()` - Intersection observer\n- `useDynamicImport()` - Dynamic component loading\n- `useHoverPreload()` - Hover-based preloading\n\n### Utilities\n\n#### Cache Utilities\n- `CacheManager` - Advanced cache management\n- `createCacheManager(config)` - Cache factory\n- `invalidateCache(pattern)` - Cache invalidation\n\n#### SEO Utilities\n- `processSEO(content, config)` - SEO data processing\n- `generateStructuredData(content, type)` - JSON-LD generation\n- `sanitizeSEO(data)` - SEO data sanitization\n\n#### Image Utilities\n- `sanityImageLoader(config)` - Sanity image loader\n- `processImageForNextJS(image, options)` - Image processing\n- `calculateOptimalDimensions(image, constraints)` - Size calculation\n\n#### Error Utilities\n- `ErrorLogger` - Enterprise error logging\n- `logError(error, context)` - Error logging\n- `logCriticalError(error, context)` - Critical error logging\n\n#### Lazy Loading Utilities\n- `createLazyComponent(loader, options)` - Lazy component factory\n- `preloadComponents(components)` - Batch preloading\n- `preloadByPriority(components, priority)` - Priority preloading\n\n### Types\n\nAll TypeScript definitions are included. Key types:\n\n```tsx\n// Core Types\ninterface CmsConfig { /* ... */ }\ninterface CmsContent { /* ... */ }\ninterface TemplateProps { /* ... */ }\n\n// SEO Types\ninterface SEOData { /* ... */ }\ninterface StructuredData { /* ... */ }\n\n// Cache Types\ninterface CacheConfig { /* ... */ }\ninterface CacheEntry { /* ... */ }\ninterface CacheMetrics { /* ... */ }\n\n// Error Types\ninterface ErrorContext { /* ... */ }\ninterface ErrorLogEntry { /* ... */ }\n\n// Image Types\ninterface ImageProcessingOptions { /* ... */ }\ninterface ResponsiveBreakpoint { /* ... */ }\n```\n\n## 🚀 Performance Optimization\n\n### Bundle Size\n\n- **Core**: ~15KB gzipped\n- **With all features**: ~45KB gzipped\n- **Tree-shakeable**: Import only what you need\n\n### Performance Features\n\n- ✅ **Code Splitting**: Template-level splitting\n- ✅ **Lazy Loading**: Component and route-based\n- ✅ **Image Optimization**: WebP/AVIF, responsive sizing\n- ✅ **Caching**: Multi-layer with SWR patterns\n- ✅ **Preloading**: Smart predictive loading\n- ✅ **Error Handling**: Non-blocking error recovery\n- ✅ **SEO Optimization**: Complete meta tag management\n\n### Lighthouse Score Improvements\n\nTypical improvements with this package:\n- **Performance**: +15-25 points\n- **Accessibility**: +10-15 points  \n- **Best Practices**: +5-10 points\n- **SEO**: +20-30 points\n\n## 🏗️ Architecture\n\n### System Overview\n\n```\n┌─────────────────────────────────────────┐\n│                CmsProvider              │\n├─────────────────────────────────────────┤\n│  ┌─────────────┐  ┌─────────────────┐   │\n│  │ Cache Layer │  │ Error Handling  │   │\n│  └─────────────┘  └─────────────────┘   │\n├─────────────────────────────────────────┤\n│  ┌─────────────┐  ┌─────────────────┐   │\n│  │ SEO System  │  │ Image Optimizer │   │\n│  └─────────────┘  └─────────────────┘   │\n├─────────────────────────────────────────┤\n│           Template Engine               │\n├─────────────────────────────────────────┤\n│           Sanity Client                 │\n└─────────────────────────────────────────┘\n```\n\n### Key Design Principles\n\n- **Progressive Enhancement**: Works without JavaScript\n- **Performance First**: Optimized for Core Web Vitals\n- **Developer Experience**: Rich TypeScript support\n- **Accessibility**: WCAG 2.1 AA compliant\n- **SEO Optimized**: Comprehensive meta tag management\n- **Error Resilient**: Graceful degradation patterns\n\n## 🧪 Testing\n\n### Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Watch mode\nnpm run test:watch\n\n# Coverage report\nnpm run test:coverage\n\n# CI mode\nnpm run test:ci\n```\n\n### Test Coverage\n\nCurrent test coverage: **>90%** across all modules\n\n- ✅ **Components**: 95% coverage\n- ✅ **Hooks**: 92% coverage  \n- ✅ **Utilities**: 94% coverage\n- ✅ **Error Handling**: 97% coverage\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n\n### Development Setup\n\n```bash\n# Clone repository\ngit clone https://github.com/ai-growth/nextjs.git\ncd nextjs\n\n# Install dependencies\nnpm install\n\n# Start development\nnpm run dev\n\n# Run tests\nnpm test\n\n# Build package\nnpm run build\n```\n\n### Code Quality Standards\n\n- **TypeScript**: Strict mode enabled\n- **ESLint**: Airbnb configuration + custom rules\n- **Prettier**: Consistent code formatting\n- **Husky**: Pre-commit hooks\n- **Jest**: Comprehensive testing\n- **Conventional Commits**: Standardized commit messages\n\n## 📚 Documentation\n\n- 📖 **[Getting Started Guide](docs/getting-started.md)**\n- 🔧 **[Configuration Reference](docs/configuration.md)**\n- 🎨 **[Template Customization](docs/templates.md)**\n- 🚀 **[Performance Guide](docs/performance.md)**\n- 🛡️ **[Error Handling Guide](docs/error-handling.md)**\n- 🔍 **[SEO Optimization](docs/seo.md)**\n- 🖼️ **[Image Optimization](docs/images.md)**\n- 📊 **[Caching Strategies](docs/caching.md)**\n- 🧪 **[Testing Guide](docs/testing.md)**\n- 🔧 **[Troubleshooting](docs/troubleshooting.md)**\n\n## 🔧 Requirements\n\n- **Node.js**: 16.0.0 or higher\n- **Next.js**: 12.0.0 or higher (13+ recommended)\n- **React**: 17.0.0 or higher (18+ recommended)\n- **TypeScript**: 4.5+ (optional but recommended)\n- **Sanity CMS**: Active project with content\n\n## 🌐 Browser Support\n\nModern browsers supporting ES2020:\n- **Chrome**: 80+\n- **Firefox**: 72+  \n- **Safari**: 13.1+\n- **Edge**: 80+\n\n## 📄 License\n\nMIT © [AI Growth Team](https://github.com/ai-growth)\n\n## 🙏 Acknowledgments\n\nBuilt with these amazing technologies:\n- [Next.js](https://nextjs.org/) - The React framework\n- [Sanity](https://www.sanity.io/) - The headless CMS\n- [React](https://reactjs.org/) - UI library\n- [TypeScript](https://www.typescriptlang.org/) - Type safety\n\n## 📞 Support & Community\n\n- 📚 **[Documentation](https://github.com/ai-growth/nextjs#readme)**\n- 🐛 **[Bug Reports](https://github.com/ai-growth/nextjs/issues)**\n- 💬 **[Discussions](https://github.com/ai-growth/nextjs/discussions)**\n- 📧 **[Email Support](mailto:support@ai-growth.com)**\n- 💭 **[Feature Requests](https://github.com/ai-growth/nextjs/issues/new?template=feature_request.md)**\n\n---\n\n<div align=\"center\">\n\n**Made with ❤️ by the [AI Growth Team](https://github.com/ai-growth)**\n\n[⭐ Star us on GitHub](https://github.com/ai-growth/nextjs) • [📦 View on npm](https://www.npmjs.com/package/@ai-growth/nextjs)\n\n</div>\n\n## Environment Variable Configuration\n\nThis library supports both regular environment variables and Next.js public environment variables for better flexibility:\n\n### Variable Priority\n\nWhen configuring the Sanity connection, the library checks for variables in the following order:\n\n1. Next.js public variables (`NEXT_PUBLIC_*`) if available\n2. Regular variables as fallback\n\n### Supported Variables\n\n| Purpose          | Next.js Public Variable        | Regular Variable        | Required? |\n|------------------|--------------------------------|-------------------------|-----------------------|\n| Project ID       | `NEXT_PUBLIC_SANITY_PROJECT_ID`| `SANITY_PROJECT_ID`     | Yes                   |\n| Dataset          | `NEXT_PUBLIC_SANITY_DATASET`   | `SANITY_DATASET`        | Yes                   |\n| API Version      | `NEXT_PUBLIC_SANITY_API_VERSION`| `SANITY_API_VERSION`    | No (default: 2023-05-03) |\n| CMS Route Path   | `NEXT_PUBLIC_CMS_ROUTE_PATH`   | `CMS_ROUTE_PATH`        | No (default: /cms/)   |\n| API Token        | -                              | `SANITY_API_TOKEN`      | No*                   |\n\n*API Token Note: The API token is only required for:\n- Writing data to Sanity\n- Accessing draft content\n- Bypassing the CDN for real-time content\n\nFor read-only access to published content, you can omit the API token entirely. The library will automatically use the Sanity CDN for better performance when no token is provided.\n\n### Usage in Client vs Server Components\n\n- **Server Components**: Can access all variables\n- **Client Components**: Can only access `NEXT_PUBLIC_*` variables or variables exposed through the client-safe configuration helpers\n\n### Example Configuration\n\n```env\n# .env file\n# Public variables (accessible in browser)\nNEXT_PUBLIC_SANITY_PROJECT_ID=your-project-id\nNEXT_PUBLIC_SANITY_DATASET=production\n\n# Server-only variables (not exposed to browser)\nSANITY_API_TOKEN=your-api-token  # Optional, for write access or draft content\n```","readmeFilename":"README.md"}