Base app architecture:

    Route groups for customer, staff and owner.
* Reusable design system with around 20 UI components.
* Complete Prisma schema.
* Authentication with email/password and Google.
* Role and permission model.
* Protected routes.
* Clean separation between features, services, components and shared utilities.
This commit is contained in:
Stefan Lazic committed 2026-08-02 17:47:23 +01:00
1 parent 468d163299
commit 090646fdfd
201 files changed
+31984

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
import { PrismaClient } from "@/generated/prisma/client";
import { PrismaPg } from "@prisma/adapter-pg";
/**
* Single Prisma Client instance for the whole app.
*
* Prisma 7 requires a driver adapter instead of a `datasource.url` in the
* schema (see prisma/schema.prisma). This is the ONLY file that imports
* `@prisma/adapter-pg` — switching to MySQL later means swapping this one
* adapter (`@prisma/adapter-mariadb`), updating `datasource.provider` in
* the schema, and re-running `prisma migrate dev`. No other file in the
* app touches the database driver directly.
*/
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};
const adapter = new PrismaPg({
connectionString: process.env.DATABASE_URL,
});
export const prisma =
globalForPrisma.prisma ??
new PrismaClient({
adapter,
log: process.env.NODE_ENV === "development" ? ["warn", "error"] : ["error"],
});
// Reuse the client across hot-reloads in dev so we don't exhaust the
// connection pool every time a file changes.
if (process.env.NODE_ENV !== "production") {
globalForPrisma.prisma = prisma;
}