Giter VIP home page Giter VIP logo

next-auth-drizzle-template's Introduction

Next.js + PostgreSQL + Auth.js + Drizzle Starter

This Next.js template integrates PostgreSQL for database management, Auth.js for Google and GitHub authentication, and Drizzle as the ORM. It provides features like Google and GitHub authentication, role-based user authentication, and a user management page.

Features

  • Google and GitHub authentication
  • Role-based user authentication with a visually appealing login page
  • User Management page

Getting Started

1. Clone the Repository and Install Dependencies

Clone the repository and delete the .git folder to initialize your own git repository.

git clone https://github.com/mohitkumaragrawal/next-auth-drizzle-template.git

Then, install dependencies using pnpm.

pnpm i

2. Create a .env file in your root directory

Copy the .env.example file to .env.

3. Setup your Github OAuth Client

4. Setup your Google OAuth Client

5. Generate the NEXTAUTH_SECRET

  • Run this command to generate the NEXTAUTH_SECRET
openssl rand -base64 32

6. Setup your database

  • I'm using Docker to spin up PostgreSQL just install docker and run sudo docker-compose up -d

  • Create all the required tables in the database using pnpm db:push

7. You are all set!

  • Run the development server
pnpm dev
  • Optionally, open Drizzle Studio using pnpm db:studio and assign the owner role to yourself by adding a row in the userRole table with your user ID as the userId and owner as the role.

Now, you're ready to start developing with this Next.js template!

next-auth-drizzle-template's People

Contributors

mohitkumaragrawal avatar

Stargazers

Aman Umrao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.