init-auth
v1.0.1
Published
CLI to add NextAuth boilerplate to Next.js projects
Downloads
15
Maintainers
Readme
NextAuth setup
A CLI tool to quickly set up NextAuth.js boilerplate in a Next.js project.
It generates all the necessary files, adds dependencies to package.json, and sets up environment variables.
Features
- Generates
src/authfolder with:auth.config.ts– NextAuth configurationauth.ts– NextAuth instance with credentials providerget-session.ts– Helper to get session on the serveractions.ts– Sign-in and sign-out server actions
- Creates
src/middleware.tsfor protected routes - Adds
"next-auth": "^5.0.0-beta.5"topackage.json(without installing) - Creates/updates
.env.localwith:NEXTAUTH_SECRET(auto-generated)NEXT_PUBLIC_SESSION_AGE(default900seconds)
Installation
You don’t need to install globally. Use npx:
npx init-auth