1.0.2 ⢠Published 8 months ago
@husseinmoqbel7/create-next-auth-starter v1.0.2
Next.js Auth Prisma Starter CLI
A command-line tool to quickly scaffold a Next.js project with authentication, Prisma, and email functionality pre-configured.
Features
- š Authentication ready with NextAuth.js
- šØ Email functionality configured with Resend
- š OAuth support for Google and GitHub
- šļø Database integration with Prisma
- šØ Styled with Tailwind CSS
- š Quick setup process
- ā” Performance optimized
- š± Fully responsive
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js (version 16.x or higher)
- npm or yarn
- Git
Installation
Run directly using npx:
npx @husseinmoqbel7/create-next-auth-starter my-project-name
Usage
- Create a new project:
npx @husseinmoqbel7/create-next-auth-starter my-project-name
- Follow the setup steps:
cd my-project-name
Configure your environment variables in
.env
:- Generate AUTH_SECRET using
npx auth
- Set up your database URL
- Configure OAuth credentials (Google, GitHub)
- Add Resend API key and email
- Generate AUTH_SECRET using
Start the development server:
npm run dev
Environment Variables
Create a .env
file in your project root and add the following variables:
DATABASE_URL=""
# Auth Secret from `npx auth`
AUTH_SECRET=""
# Google OAuth Credentials
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
# Github OAuth Credentials
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
# Resend API Key
RESEND_API_KEY=""
# Next.js App URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# Resend Email
RESEND_EMAIL=""
Configuration Guide
Database Setup
- Create a database for your project
- Update
DATABASE_URL
in.env
- Run migrations:
npx prisma migrate dev
Authentication Setup
- Generate AUTH_SECRET:
npx auth
Set up Google OAuth:
- Go to Google Cloud Console
- Create a new project
- Enable OAuth 2.0
- Add credentials to
.env
Set up GitHub OAuth:
- Go to GitHub Settings > Developer Settings > OAuth Apps
- Create a new OAuth App
- Add credentials to
.env
Email Setup
- Create an account at Resend
- Get your API key
- Update RESEND_API_KEY and RESEND_EMAIL in
.env
Project Structure
my-project/
āāā app/
ā āāā api/
ā āāā auth/
ā āāā ...
āāā components/
āāā lib/
āāā prisma/
āāā public/
āāā .env
āāā .env.example
āāā package.json
Features In Detail
Authentication
- Email/Password authentication
- OAuth providers (Google, GitHub)
- Protected routes
- Session management
- Password reset functionality
Database
- Prisma ORM integration
- User model pre-configured
- Easy-to-extend schema
- Automatic migrations
- Transactional email support
- Email templates
- Password reset emails
- Welcome emails
Contributing
We welcome contributions! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you find this helpful, please give it a āļø on GitHub!