/doc
Last active
June 20, 2024 13:52
NextAuth Prisma MongoDb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://desishub.notion.site/How-to-create-a-Step-by-Step-Guide-Adding-Google-Authentication-with-NextAuth-in-Next-js-13-Prisma-2e08646b1875402e9d8cb988a108fd77 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libs/db.js | |
// Create the global prisma instance : create a file in libs called db | |
import { PrismaClient } from "@prisma/client"; | |
const db = globalThis.prisma || new PrismaClient(); | |
if (process.env.NODE_ENV !== "production") globalThis.prisma = db; | |
export default db; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pnpm add prisma -g | |
pnpm add -D prisma | |
pnpm add mongoose | |
pnpm add @prisma/client | |
// Initialize Prisma configuration: | |
npx prisma init --datasource-provider=mongodb | |
// after creating models | |
// Generate the prisma client instance | |
npx prisma generate | |
// Push the Models to the Datasea | |
npx prisma db push | |
/// run the studio | |
npx prisma studio | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment