Prisma Schema Generator
Added Apr 2, 2026
About This Prompt
This prompt generates complete Prisma database schemas from application requirements, including models, relationships, indexes, enums, and seed data. It handles the translation from business logic to database structure, applying best practices like soft deletes, audit trails, and composite indexes that developers often forget during initial schema design. The output includes not just the schema file but also migration strategy notes and Prisma Client query examples for common access patterns. It is ideal for full-stack developers starting new projects with Prisma, teams migrating from raw SQL to an ORM, or developers who want a senior-level schema review of their data model before implementation.
Variables to Customize
[APP_DESCRIPTION]
What the application does at a high level
Example: A SaaS project management tool where organizations have workspaces, teams can create projects with tasks, and tasks support comments, file attachments, and time tracking
[DATA_ENTITIES]
The main data objects in the system
Example: Organization, Workspace, User, Team, Project, Task, Comment, Attachment, TimeEntry
[RELATIONSHIPS]
Key relationships and business rules between entities
Example: Users belong to one Organization but can be on multiple Teams. Tasks are assigned to one User but can have multiple watchers. Projects belong to one Workspace. Time entries are linked to both a Task and a User.
[DATABASE_PROVIDER]
The target database engine
Example: PostgreSQL
Tips for Best Results
- Include any performance requirements like expected row counts per table so the index strategy can be optimized accordingly
- Mention if you need multi-tenancy since this fundamentally affects how the schema is structured with organization-scoped queries
- Specify if you are using Prisma with Next.js, Express, or another framework since this affects the recommended query patterns
Example Output
```prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum TaskStatus {
BACKLOG
TODO
IN_PROGRESS
IN_REVIEW
DONE
CANCELLED
}
model Organization {
id String @id @default(cuid())
name String
slug String @unique
users User[]
workspaces Workspace[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
@@index([slug])
}
```