{"_id":"@0ju1c3-oss/next-auth-cli","_rev":"3-c527a7d157e387079686b20587a48abf","name":"@0ju1c3-oss/next-auth-cli","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@0ju1c3-oss/next-auth-cli","version":"1.0.0","keywords":["nextauth","next-auth","nextjs","cli","oauth","google","authentication","setup"],"author":"","license":"ISC","_id":"@0ju1c3-oss/next-auth-cli@1.0.0","maintainers":[{"name":"0ju1c3","email":"otapadia@gmail.com"}],"homepage":"https://github.com/0ju1c3/next-auth-cli#readme","bugs":{"url":"https://github.com/0ju1c3/next-auth-cli/issues"},"bin":{"next-auth-setup":"bin/cli.js"},"dist":{"shasum":"4069eb19ae3b3ebb87a5f7ee565bddf551e4d22c","tarball":"https://registry.npmjs.org/@0ju1c3-oss/next-auth-cli/-/next-auth-cli-1.0.0.tgz","fileCount":4,"integrity":"sha512-XzZBQhPM+rOB9khwkWm+VBFM93JtVe3Hv4I7XIqpx1b3UZl+GstWgdzHJqTPGwLSci8DC7ZIFhNspJbkWVMTAQ==","signatures":[{"sig":"MEYCIQCUy4W2fka+8s3ocrDIup2HIC+Rpa6vObzX88OwZxTqIAIhAMhJP45qKHLFQ04w4qA/gK29Tr+CJ6okURgtSRXmOrCX","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96371},"main":"./dist/index.js","type":"module","gitHead":"952a0dcf5c72c7ea58b729510b590887eea450b9","scripts":{"dev":"bun run src/cli.ts","test":"echo \"Error: no test specified\" && exit 1","build":"bun build src/cli.ts --outdir dist --target node --format esm","prepublishOnly":"bun run build"},"_npmUser":{"name":"0ju1c3","email":"otapadia@gmail.com"},"repository":{"url":"git+https://github.com/0ju1c3/next-auth-cli.git","type":"git"},"_npmVersion":"11.5.1","description":"CLI tool to automatically setup NextAuth.js with Google OAuth in Next.js App Router projects","directories":{},"_nodeVersion":"24.7.0","dependencies":{"chalk":"^5.3.0","fs-extra":"^11.2.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.2","@types/node":"^22.10.5","@types/fs-extra":"^11.0.4"},"peerDependencies":{"next":">=13.0.0","react":">=18.0.0","next-auth":">=5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/next-auth-cli_1.0.0_1768280948405_0.4284512148625059","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@0ju1c3-oss/next-auth-cli","version":"1.0.1","keywords":["nextauth","next-auth","nextjs","cli","oauth","google","authentication","setup"],"author":"","license":"ISC","_id":"@0ju1c3-oss/next-auth-cli@1.0.1","maintainers":[{"name":"0ju1c3","email":"otapadia@gmail.com"}],"homepage":"https://github.com/0ju1c3/next-auth-cli#readme","bugs":{"url":"https://github.com/0ju1c3/next-auth-cli/issues"},"bin":{"next-auth-setup":"bin/cli.js"},"dist":{"shasum":"5cbb1943581e194f8b14c632df728705e8802744","tarball":"https://registry.npmjs.org/@0ju1c3-oss/next-auth-cli/-/next-auth-cli-1.0.1.tgz","fileCount":4,"integrity":"sha512-s0vfaVJgrGcBAwd6vMST9XFKcSCJlyq4OVfRVUZq+LU6m36owKSpBRo/BJh+i6vAis6jPuolu1+Ativ3QOAYwQ==","signatures":[{"sig":"MEYCIQC9LC7PTp1atVsgjd2gof3Q8nR/nughjTC1/BxujdFXowIhAIgsxOLlCeX/MURd5yZMwNaYgPOntGIedFIaUCgnO6By","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":96953},"main":"./dist/index.js","type":"module","gitHead":"769a7a470d9430173f892ca33839b5b3d0f5ec13","scripts":{"dev":"bun run src/cli.ts","test":"echo \"Error: no test specified\" && exit 1","build":"bun build src/cli.ts --outdir dist --target node --format esm","prepublishOnly":"bun run build"},"_npmUser":{"name":"0ju1c3","email":"otapadia@gmail.com"},"repository":{"url":"git+https://github.com/0ju1c3/next-auth-cli.git","type":"git"},"_npmVersion":"11.5.1","description":"CLI tool to automatically setup NextAuth.js authentication in Next.js App Router projects","directories":{},"_nodeVersion":"24.7.0","dependencies":{"chalk":"^5.3.0","fs-extra":"^11.2.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.2","@types/node":"^22.10.5","@types/fs-extra":"^11.0.4"},"peerDependencies":{"next":">=13.0.0","react":">=18.0.0","next-auth":">=5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/next-auth-cli_1.0.1_1768281300399_0.061949464521451336","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@0ju1c3-oss/next-auth-cli","version":"1.0.3","description":"CLI tool to automatically setup NextAuth.js authentication in Next.js App Router projects","main":"./dist/index.js","type":"module","bin":{"next-auth-setup":"bin/cli.js"},"scripts":{"build":"bun build src/cli.ts --outdir dist --target node --format esm","dev":"bun run src/cli.ts","prepublishOnly":"bun run build","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/0ju1c3/next-auth-cli.git"},"keywords":["nextauth","next-auth","nextjs","cli","oauth","google","authentication","setup"],"author":"","license":"ISC","bugs":{"url":"https://github.com/0ju1c3/next-auth-cli/issues"},"homepage":"https://github.com/0ju1c3/next-auth-cli#readme","dependencies":{"chalk":"^5.3.0","fs-extra":"^11.2.0"},"devDependencies":{"@types/fs-extra":"^11.0.4","@types/node":"^22.10.5","typescript":"^5.7.2"},"peerDependencies":{"next":">=13.0.0","next-auth":">=5.0.0","react":">=18.0.0"},"_id":"@0ju1c3-oss/next-auth-cli@1.0.3","gitHead":"0b18b89cee5a36d686e659e712cc91cddef91aa0","_nodeVersion":"24.7.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-UZLuCg+i814ZJ5WLOUIQkF49aC07qgwzMvVEIsY0jKF+qlxMW7u+0rwJSV/uHUha2Mlv9/DH6unqlbUxvUIzjw==","shasum":"fb9a10bbe2cdc5866a87f7b6a9249ec77eeb4b77","tarball":"https://registry.npmjs.org/@0ju1c3-oss/next-auth-cli/-/next-auth-cli-1.0.3.tgz","fileCount":4,"unpackedSize":98403,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDeA4Nr6MyMY92SWUPORSkTtQte3WZFvGgYNwXjYF/GOwIgTLSye+3l2Rt1/ed41zH7LgbPag2mCDSn5PCeSPDAmKw="}]},"_npmUser":{"name":"0ju1c3","email":"otapadia@gmail.com"},"directories":{},"maintainers":[{"name":"0ju1c3","email":"otapadia@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/next-auth-cli_1.0.3_1768287502868_0.9609223343008471"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-13T05:09:08.304Z","modified":"2026-01-13T06:58:23.176Z","1.0.0":"2026-01-13T05:09:08.541Z","1.0.1":"2026-01-13T05:15:00.536Z","1.0.3":"2026-01-13T06:58:22.994Z"},"bugs":{"url":"https://github.com/0ju1c3/next-auth-cli/issues"},"license":"ISC","homepage":"https://github.com/0ju1c3/next-auth-cli#readme","keywords":["nextauth","next-auth","nextjs","cli","oauth","google","authentication","setup"],"repository":{"type":"git","url":"git+https://github.com/0ju1c3/next-auth-cli.git"},"description":"CLI tool to automatically setup NextAuth.js authentication in Next.js App Router projects","maintainers":[{"name":"0ju1c3","email":"otapadia@gmail.com"}],"readme":"# @0ju1c3-oss/next-auth-cli\n\nA CLI tool to automatically setup NextAuth.js authentication in Next.js App Router projects.\n\n## Features\n\n- 🚀 **Quick Setup**: Automatically generates all necessary NextAuth.js files\n- 📦 **Auto-Install**: Automatically installs `next-auth@beta` if not already present\n- 🔍 **Smart Detection**: Detects `src/` directory, App Router structure, and package manager (bun/npm/yarn/pnpm)\n- 🎨 **Ready-to-use Components**: Pre-built login button and user profile components\n- 🔒 **Protected Routes**: Middleware configuration with example protected routes\n- 📝 **TypeScript Support**: All generated files are TypeScript-ready\n- 🔐 **Authentication Providers**: Currently ships with Google OAuth (more providers coming soon!)\n\n> **Note**: This package currently generates Google OAuth setup. Support for multiple providers (GitHub, Discord, Credentials, etc.) and custom configuration files is planned. See [TODO.md](TODO.md) for the full roadmap.\n\n## Installation\n\n### As a dev dependency (recommended)\n\n```bash\nbun add -d @0ju1c3-oss/next-auth-cli\n```\n\nor\n\n```bash\nnpm install -D @0ju1c3-oss/next-auth-cli\n```\n\n### Global installation\n\n```bash\nbun add -g @0ju1c3-oss/next-auth-cli\n```\n\n## Usage\n\nNavigate to your Next.js project root and run:\n\n```bash\nbunx next-auth-setup\n```\n\nor with npx:\n\n```bash\nnpx @0ju1c3-oss/next-auth-cli\n```\n\n## What Gets Generated\n\nThe CLI creates the following files in your project:\n\n### 1. **Authentication Configuration**\n- `auth.ts` (or `src/auth.ts`) - NextAuth.js configuration (currently: Google OAuth provider)\n\n### 2. **Middleware**\n- `middleware.ts` (or `src/middleware.ts`) - Route protection for `/dashboard/*` and `/profile/*`\n\n### 3. **API Route**\n- `app/api/auth/[...nextauth]/route.ts` - NextAuth.js route handler\n\n### 4. **Components**\n- `components/login-button.tsx` - Sign in/out button component\n- `components/user-profile.tsx` - User profile display component\n\n### 5. **Environment Template**\n- `.env.local.example` - Template for required environment variables\n\n## Post-Installation Steps\n\nAfter running the CLI, follow these steps:\n\n> **Note**: The CLI automatically installs `next-auth@beta` for you if it's not already in your project!\n\n### 1. Setup Environment Variables\n\nCreate a `.env.local` file:\n\n```bash\ncp .env.local.example .env.local\n```\n\nAdd your credentials:\n\n```env\nAUTH_SECRET=your-secret-key-here\n\nAUTH_GOOGLE_ID=your-google-client-id\nAUTH_GOOGLE_SECRET=your-google-client-secret\n```\n\nGenerate a secret:\n\n```bash\nopenssl rand -base64 32\n```\n\n### 2. Get Google OAuth Credentials\n\n1. Go to [Google Cloud Console](https://console.cloud.google.com/)\n2. Create a new project or select an existing one\n3. Enable the **Google+ API**\n4. Go to **Credentials** → **Create Credentials** → **OAuth 2.0 Client ID**\n5. Add authorized redirect URI:\n   ```\n   http://localhost:3000/api/auth/callback/google\n   ```\n6. Copy the Client ID and Client Secret to your `.env.local`\n\n### 3. Wrap Your App with SessionProvider\n\nUpdate your `app/layout.tsx`:\n\n```tsx\nimport { SessionProvider } from \"next-auth/react\"\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n  return (\n    <html lang=\"en\">\n      <body>\n        <SessionProvider>\n          {children}\n        </SessionProvider>\n      </body>\n    </html>\n  )\n}\n```\n\n### 4. Use the Components\n\n```tsx\nimport LoginButton from '@/components/login-button'\nimport UserProfile from '@/components/user-profile'\n\nexport default function Page() {\n  return (\n    <div>\n      <LoginButton />\n      <UserProfile />\n    </div>\n  )\n}\n```\n\n## Protected Routes\n\nThe generated middleware protects these routes by default:\n\n- `/dashboard/*` - Dashboard pages\n- `/profile/*` - Profile pages\n\nUnauthenticated users will be redirected to the sign-in page.\n\n### Customizing Protected Routes\n\nEdit `middleware.ts` to add or remove protected routes:\n\n```typescript\nexport const config = {\n  matcher: [\"/dashboard/:path*\", \"/profile/:path*\", \"/admin/:path*\"],\n}\n```\n\n## Requirements\n\n- **Next.js**: >=13.0.0 (App Router)\n- **React**: >=18.0.0\n- **NextAuth.js**: >=5.0.0\n- **Bun** or **Node.js**: >=18.0.0\n\n## Project Structure Support\n\nThe CLI automatically detects and adapts to your project structure:\n\n### With `src/` directory\n```\nyour-project/\n├── src/\n│   ├── app/\n│   │   └── api/auth/[...nextauth]/route.ts\n│   ├── auth.ts\n│   └── middleware.ts\n└── components/\n    ├── login-button.tsx\n    └── user-profile.tsx\n```\n\n### Without `src/` directory\n```\nyour-project/\n├── app/\n│   └── api/auth/[...nextauth]/route.ts\n├── auth.ts\n├── middleware.ts\n└── components/\n    ├── login-button.tsx\n    └── user-profile.tsx\n```\n\n## Troubleshooting\n\n### Error: Not a Next.js project\n\nEnsure your `package.json` includes `next` as a dependency:\n\n```json\n{\n  \"dependencies\": {\n    \"next\": \"^14.0.0\"\n  }\n}\n```\n\n### Error: App Router not found\n\nThis CLI requires Next.js App Router (`app/` directory). Pages Router is not currently supported.\n\n### OAuth Error: redirect_uri_mismatch\n\nMake sure your Google OAuth redirect URI matches exactly:\n```\nhttp://localhost:3000/api/auth/callback/google\n```\n\nFor production, add:\n```\nhttps://yourdomain.com/api/auth/callback/google\n```\n\n## License\n\nISC\n\n## Future Roadmap\n\nSee [TODO.md](TODO.md) for planned features including:\n- Multiple authentication providers (GitHub, Discord, Twitter, Credentials, etc.)\n- Configuration file support (`next-auth-cli.json`)\n- Interactive setup mode\n- Pages Router support\n- Database session adapters\n- And more!\n\n## Contributing\n\nIssues and pull requests are welcome! Visit the [GitHub repository](https://github.com/0ju1c3/next-auth-cli).\n\n## Author\n\n[@0ju1c3](https://github.com/0ju1c3)\n","readmeFilename":"README.md"}