Act as a most advanced and expert full stack developer. Build a Web application using react with nextjs framework with all aspects of secure software development processes along with full documentation, copilot instructions about the project and mermaid diagrams. The UI design should be the most intuitive, responsive, flexible, adaptible, customizable with individual personas for each user.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Here’s a complete, end-to-end blueprint (with sample code, docs, diagrams, and Copilot prompts) for a highly secure, persona-driven Next.js/React app. Feel free to clone and adapt!
flowchart LR
subgraph “Client (Browser)”
A[Next.js App]
A --> B[Chakra UI]
A --> C[LocalStorage: theme, persona]
end
subgraph “Server (API)”
D[NextAuth.js] --> E[JWT | Session DB]
D --> F[Prisma → PostgreSQL]
G[API Routes] --> F
G --> E
end
A -- “/api/*” --> G
A -- “/auth/*” --> D
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id String @id @default(uuid())
email String @unique
name String?
role Role @default(USER)
personas Persona[]
createdAt DateTime @default(now())
}
model Persona {
id String @id @default(uuid())
user User @relation(fields: [userId], references: [id])
userId String
theme String // e.g. "dark", "light", "solarized"
layout String // custom layout selection
settings Json
createdAt DateTime @default(now())
}
enum Role {
ADMIN
USER
}
# PersonaX
## Features
- Persona-based theming & preferences
- Secure authentication & RBAC
- Next.js 13 + TypeScript + Chakra UI
## Getting Started
1. git clone ...
2. cp .env.example .env
3. npm install && npx prisma migrate deploy
4. npm run dev
## Architecture
See docs/architecture.md
🤖 7. GitHub Copilot Prompts
Use these to accelerate feature development:
“Copilot, please write a Next.js API route to fetch a user’s personas securely, validating input with Zod.”
“Copilot, generate a Chakra UI <SettingsPanel> component that dynamically renders form fields based on a settings: Json object.”
“Copilot, scaffold a GitHub Actions workflow for running ESLint, Prettier, TypeScript build, and npm audit.”
“Copilot, create a Mermaid sequence diagram for the NextAuth sign-in flow.”
📊 8. Sequence Diagram: Login Flow
mermaid
sequenceDiagram
participant U as User (Browser)
participant C as NextAuth.js
participant DB as Prisma/PostgreSQL
U->>C: POST /api/auth/callback/credentials (email, pwd)
C->>DB: SELECT * FROM User WHERE email=...
DB-->>C: User row
C->>C: verifyPassword
C-->>U: Set-Cookie session token
🎉 9. Next Steps
Flesh out each component & page
Add E2E tests (Cypress / Playwright)
Integrate real Figma designs and accessibility audits
Deploy to Vercel with Environment protection
This skeleton incorporates best practices in security, scalability, and UX flexibility. Let me know which part you’d like to dive into next!