Skip to content

The nextjs-authjs-template is a robust starter template for building modern web applications with Next.js and Auth.js (formerly NextAuth.js).

Notifications You must be signed in to change notification settings

Dannyisadog/nextjs-authentication-template

Repository files navigation

Github Intro Image

The nextjs-authjs-template is a robust starter template for building modern web applications with Next.js and Auth.js (formerly NextAuth.js). This template is designed to streamline the development process by providing a pre-configured setup that integrates user authentication and authorization seamlessly into your Next.js project.

Features:

  • FullStack Next.js application with built-in authentication.
  • User authentication with email, Google, and GitHub.
  • ORM with Prisma for database management.
  • PostgreSQL database with Docker for easy setup.
  • Email service with Resend API.
  • MUI for styling and responsive design.

Use Cases:

  • Rapidly prototype and deploy Next.js applications with built-in authentication.
  • Start new projects with a solid foundation, reducing the boilerplate code required for user management.

Getting Started

  1. Create a .env file in the root of the project and add the following
  cp .env.example .env
  1. Generate auth secret key
  npx auth secret
  1. Fill up your google & github client id & secret in .env
  ...
  AUTH_GOOGLE_ID=xxxx
  AUTH_GOOGLE_SECRET=xxxx
  
  AUTH_GITHUB_ID=xxxx
  AUTH_GITHUB_SECRET=xxxx
  ...
  1. Create your Resend api key for email service in .env
  ...
  RESEND_API_KEY=xxxx
  ...
  1. Install dependencies
  yarn install
  1. Start postgres database
  docker-compose up -d
  1. Run the development server:
  yarn dev

Open http://localhost:3000 with your browser to see the result.

About

The nextjs-authjs-template is a robust starter template for building modern web applications with Next.js and Auth.js (formerly NextAuth.js).

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages