next-secure
v1.0.7
Published
A CLI tool to add authentication to a Next.js project
Downloads
27
Readme
next-secure-cli
next-secure
next-secure
is a CLI tool to add authentication to your Next.js project. It helps you set up authentication components, configuration files, and run necessary installation commands with ease.
Installation
You can install next-secure
globally using npm:
npm install -g next-secure
Alternatively, you can use npx
to run it without installing globally:
npx next-secure
Usage
Run next-secure
in your Next.js project directory to set up authentication:
-help
orh
: Display help information.
What It Does
- Copies Directories:
- Copies the
public
directory from thetemplate
folder to your project, skipping existing files. - Copies the
_schemas
directory from thetemplate
folder to your project root. - Copies the contents of the
src
directory from thetemplate
folder to the existingsrc
directory in your project, or to the root ifsrc
does not exist.
- Copies the
- Installs Dependencies:
- Installs
next-auth@beta
,nodemailer
,@prisma/client
,@auth/prisma-adapter
, andprisma
.
- Installs
- Runs Initialization Commands:
- Initializes
shadcn
with a set of components. - Initializes Prisma.
- Initializes
- Creates Configuration Files:
- Creates or appends to
.env
and.env.local
with necessary configuration settings.
- Creates or appends to
Configuration
After running next-secure
, you need to:
- Generate Auth Secret:
- Run
openssl rand -base64 32
to generate the auth secret.
- Run
- Update
.env
and.env.local
:- Add OAuth provider details, email provider details, and database URL to the respective
.env
files.
- Add OAuth provider details, email provider details, and database URL to the respective
- Add OAuth Providers:
- Configure the OAuth providers in
@/auth/provider.js
.
- Configure the OAuth providers in
Documentation
For more details and advanced usage, please refer to the documentation.
License
This project is licensed under the ISC License - see the LICENSE file for details.
Contributing
If you would like to contribute to this project, please submit a pull request or open an issue.