Add Next.js client app with Prisma and auth
Introduce a new 'client' Next.js app scaffold: configuration files (next.config.ts, eslint.config.mjs, postcss, tsconfig), Prisma config and schema, app routes including NextAuth API and server actions, session/provider utilities, proxy, public assets, README and .gitignore. Also add IDE project files under .idea and a root README to initialize the repository structure for development.
This commit is contained in:
1 parent
d90ea58fc3
commit
50bc2eea74
30 files changed
+8913
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { PrismaClient } from "@/generated/prisma/client";
|
||||
import { PrismaPg } from "@prisma/adapter-pg";
|
||||
|
||||
const databaseUrl = process.env.DATABASE_URL;
|
||||
|
||||
if (!databaseUrl) {
|
||||
throw new Error("Missing DATABASE_URL environment variable.");
|
||||
}
|
||||
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: PrismaClient | undefined;
|
||||
};
|
||||
|
||||
export const prisma =
|
||||
globalForPrisma.prisma ??
|
||||
new PrismaClient({
|
||||
adapter: new PrismaPg({ connectionString: databaseUrl }),
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
globalForPrisma.prisma = prisma;
|
||||
}
|
||||
Reference in new issue
Block a user