Skip to content

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 15 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(Next-Auth v5): 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
  • T3 Env: Type-safe environment variables with validation

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.


Want more advanced features?

Want to use better-auth instead of auth.js or more advanced features? Check out our Enhanced Fullstack Template!

Key Improvements

  • 🔐 Better Auth - More flexible and modern authentication system
  • 🔥 Hono + Hono RPC - Type-safe API routes with Hono framework and Hono RPC client
  • 🍃 Tailwind CSS 4 - Latest version with enhanced features
  • ⚛️ React 19 - Latest React with improved performance
  • 📦 AWS S3 Integration - Ready-to-use file upload functionality
  • 🔧 Enhanced DX - Pre-commit hooks, better linting.
  • 💡 AI-ready - Pre-configured AI-ready configuration for Cursor(AI IDE).

👀Check the repository: caru-ini/fullstack-template

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •