This application is a Next.js 14 starter kit for authentication, featuring NextAuth, Prisma Adapter, and MongoDB. It utilizes TypeScript, React, and Shadcn-UI, with styling provided by Tailwind CSS. Additionally, the starter kit includes protected routes, theme toggling, and a user account nav in the nav bar. Follow the instructions below to quickly get started with this repository and begin developing your app. If you find this project helpful, please consider starring ⭐ this repository!
- Node.js version 18.18 or higher
- MongoDB database
- Google Provider: Google Cloud project with an OAuth consent screen created.
- GitHub Provider: GitHub OAuth App
-
Clone the repository into a new directory.
git clone https://github.com/0mppula/nextjs-mongodb-prisma-adapter-starter-kit.git
-
Install the required dependencies
npm i
-
Clone the repository into a new directory.
git clone https://github.com/0mppula/nextjs-mongodb-prisma-adapter-starter-kit.git <new-repo-name>
-
Navigate into the new directory.
cd <new-repo-name>
-
Remove the existing Git history.
rm -rf .git
-
Initialize a new Git repository.
git init
-
Add the
<new-repo-name>
to yourpackage.json
files top levelname
before installing node modules.{ "name": "new-repo-name" }
-
Install the required dependencies
npm i
In the root of the project create an .env
file and declare the following variables:
DATABASE_URL=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
NEXTAUTH_SECRET=
Populate the variables with the corresponding data.
-
Push the changes from the Prisma schema to the database
npx prisma db push
-
Generate Prisma Client for type safety across the app.
npx prisma generate
npm run dev
Running commands with npm npm run [command]
command | description |
---|---|
dev |
Starts a development instance of the app |
lint |
Runs ESLint to check for errors and warnings. Errors will fail the build, but warnings will not. |
- Next.js: A React framework enabling server-side rendering and static site generation for high-performance web applications.
- Tailwind CSS: A utility-first CSS framework for rapidly creating custom designs directly in your markup.
- MongoDB: MongoDB is an open-source NoSQL database that stores data in flexible, JSON-like documents, allowing for scalable, high-performance data management and real-time data processing.
- Prisma: A next-generation ORM for Node.js and TypeScript that simplifies database access and management with an intuitive query API.
- NextAuth: A complete open-source authentication solution for Next.js applications.
- Shadcn: Different component/UI libraries used for design
- Front-end Framework: Next.js (v13.4.12)
- UI Library: shadcn-ui
- UI Styling: tailwindcss (v3.4.1) with tailwindcss-animate (v1.0.7)
- Theming: next-themes (v0.3.0)
- Icons: react-icons (v5.3.0) & lucide-react (v0.434.0)
- CSS Utility: clsx (v2.1.1)
- Class Variance Management: class-variance-authority (v0.7.0)
- Prisma ORM: @prisma/client (v5.18.0) with prisma (v5.18.0) as a dev dependency
- User Authentication: next-auth (v4.24.7) with prisma-adapter (v1.0.7)
- TypeScript: (v^5)
- Type Definitions: @types/node (v^20), @types/react (^18), @types/react-dom (v^18)
This project is licensed under the MIT License.