Installation
Get started with the Next.js Authentication Template in just a few minutes.
Requirements
| Requirement | Version | Notes |
|---|---|---|
| Node.js | >= 18.17 | LTS version recommended |
| npm / pnpm / yarn | latest | Any package manager |
| Git | latest | For cloning the repository |
Quick Start
Follow these steps to get the template running locally:
Step 1: Clone the Repository
git clone https://github.com/HieuNT44/next-auth-template.gitStep 2: Install Dependencies
# Using npm
npm install
# Using pnpm
pnpm install
# Using yarn
yarn installStep 3: Configure Environment
Copy the example environment file and update it with your credentials:
cp .env.example .env.localStep 4: Start Development Server
npm run devOpen http://localhost:3000 in your browser to see the application.
Environment Variables
Configure your authentication providers by updating the .env.local file:
NextAuth.js Configuration
| Variable | Description | Required |
|---|---|---|
NEXTAUTH_SECRET | Secret key for encrypting sessions | Yes |
NEXTAUTH_URL | Base URL of your application | Yes |
OAuth Providers
| Provider | Client ID | Client Secret |
|---|---|---|
GOOGLE_CLIENT_ID | GOOGLE_CLIENT_SECRET | |
FACEBOOK_CLIENT_ID | FACEBOOK_CLIENT_SECRET | |
INSTAGRAM_CLIENT_ID | INSTAGRAM_CLIENT_SECRET | |
| LINE | LINE_CLIENT_ID | LINE_CLIENT_SECRET |
Firebase Configuration (Optional)
| Variable | Description |
|---|---|
NEXT_PUBLIC_FIREBASE_API_KEY | Firebase API key |
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN | Firebase auth domain |
NEXT_PUBLIC_FIREBASE_PROJECT_ID | Firebase project ID |
Available Scripts
| Command | Description |
|---|---|
npm run dev | Start development server |
npm run build | Build for production |
npm run start | Start production server |
npm run lint | Run ESLint |
npm run format | Format code with Prettier |
npm run test | Run tests with Vitest |
Next Steps
After installation, explore these guides:
- Introduction - Overview of the template
- Authentication - Configure auth providers
- Internationalization - Add more languages