Prompt Details
Model
Chat - (gpt-5.6)
Token size
235
Example input
[Core Frontend & React Framework]: Next.js 14 App Router, TypeScript, Tailwind CSS, Shadcn UI
[Backend Runtime & Database Engine]: Node.js Edge runtime with PostgreSQL (Neon Serverless) and Prisma ORM
[Authentication & State Architecture]: NextAuth.js (Auth.js v5) with Google OAuth, React Server Components (RSC), and Zustand for local state
[Key Feature Scope & Deployment Target]: Multi-tenant B2B SaaS dashboard with organization billing; deployed to Vercel
Example output
### 1. Architecture Blueprint & Production Directory Tree
├── prisma/
│ └── schema.prisma
├── src/
│ ├── app/
│ │ ├── (auth)/
│ │ │ └── login/page.tsx
│ │ ├── (dashboard)/
│ │ │ └── [orgId]/page.tsx
│ │ ├── api/
│ │ │ ├── auth/[...nextauth]/route.ts
│ │ │ └── organizations/[orgId]/route.ts
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── components/ui/
│ ├── lib/
│ │ ├── auth.ts
│ │ └── db.ts
│ └── types/index.ts
├── middleware.ts
└── tsconfig.json
---
### 2. Typed Database Schema & Client Configuration
// prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model Organization {
id String @id @default(cuid())
name String
slug String @unique
createdAt DateTime @default(now())
users User[]
}
model User {
id String @id @default(cuid())
email String @unique
role String @default("MEMBER")
organizationId String?
organization Organization? @relation(fields: [organizationId], references: [id])
}
// src/lib/db.ts
import { PrismaClient } from "@prisma/client";
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient | undefined };
export const db = globalForPrisma.prisma ?? new PrismaClient();
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = db;
---
### 3. Authentication & Protected Middleware Setup
// middleware.ts
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
import { auth } from "@/lib/auth";
export async function middleware(req: NextRequest) {
const session = await auth();
const isDashboard = req.nextUrl.pathname.startsWith("/org_");
if (!session && isDashboard) {
return NextResponse.redirect(new URL("/login", req.url));
}
return NextResponse.next();
}
export const config = {
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
};
---
### 4. Core API Route & Client Query Pattern
// src/app/api/organizations/[orgId]/route.ts
import { NextResponse } from "next/server";
import { auth } from "@/lib/auth";
import { db } from "@/lib/db";
export async function GET(req: Request, { params }: { params: { orgId: string } }) {
const session = await auth();
if (!session?.user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
const org = await db.organization.findUnique({
where: { id: params.orgId },
include: { users: true },
});
if (!org) return NextResponse.json({ error: "Not found" }, { status: 404 });
return NextResponse.json({ data: org });
}
Get this prompt + 9 more with Select$14 your first month, then $19/mo$14 first month, then $19/mo
View SelectBy purchasing this prompt, you agree to our terms of service
GPT-5.6
Architect production-ready, type-safe full-stack React applications instantly. Engineered for software engineers and tech leads, this engine generates complete project folder structures, TypeScript configs, database schemas, auth workflows, and core API patterns tailored to your stack.
...more
Added over 1 month ago
