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.
- 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
-
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
-
Install dependencies:
pnpm i
-
Generate auth.js secret
pnpm dlx auth@latest secret
-
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
-
Set up the database:
docker-compose up -d
-
Run Prisma migrations:
pnpm prisma:migrate
-
Start the development server:
pnpm dev
Recommend Vercel or Coolify for deployment.
On coolify (or other self-hosted deployment platforms), you should set AUTH_TRUST_HOST=true
in environment variables.
This project is released under the MIT License. See the LICENSE file for details.
If you have any questions or need assistance, please open an issue or contact the project maintainer directly.
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.