Skip to content

Next.js 15 + Auth.js + prisma + shadcn/ui Starter Kit

License

Notifications You must be signed in to change notification settings

caru-ini/next-authjs-template

Repository files navigation

Next.js Auth.js Template

This project is a web application template with authentication features, using Next.js 14 and Auth.js. It incorporates modern web development best practices, enabling rapid development initiation.

Key Features

  • Next.js 15(App Router): Utilizing the latest React framework
  • ESLint 9: Latest version of ESLint (flat config)
  • Auth.js: Easy implementation of a secure authentication system
  • Tailwind CSS: Customizable utility-first CSS framework
  • shadcn/ui: Functional UI components
  • Prisma: Efficient database operations with a type-safe ORM
  • PostgreSQL: Reliable relational database
  • Docker: Database containerization for local development

Setup Instructions

  1. Clone the repository

    With create-next-app

    pnpm create next-app -e https://github.com/caru-ini/next-authjs-template

    or using GitHub CLI

    gh repo create <your-repo-name> --template https://github.com/caru-ini/next-authjs-template --clone
  2. Install dependencies:

    pnpm i
  3. Generate auth.js secret

    pnpm dlx auth@latest secret
  4. Set up environment variables: Create a .env.local file and set the necessary environment variables:

    AUTH_SECRET=your_auth_secret # already generated
    
    DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
    AUTH_GITHUB_ID=your_github_id
    AUTH_GITHUB_SECRET=your_github_secret
  5. Set up the database:

    docker-compose up -d
  6. Run Prisma migrations:

    pnpm prisma:migrate
  7. Start the development server:

    pnpm dev

Deployment

Recommend Vercel or Coolify for deployment.

On coolify (or other self-hosted deployment platforms), you should set AUTH_TRUST_HOST=true in environment variables.

Technologies Used

License

This project is released under the MIT License. See the LICENSE file for details.

Support

If you have any questions or need assistance, please open an issue or contact the project maintainer directly.

Star Us!

If you find this project useful, we'd greatly appreciate it if you could star our GitHub repository. Your support is a huge encouragement for us to continue improving and maintaining this project.

Releases

No releases published

Packages

No packages published