Prisma schema generator. Generate Prisma schema models, relations, and attributes from simple table definitions.
100% browser-based — your data never leaves your device
Generate Prisma schema models from a simple table definition syntax.
Prisma's schema.prisma file is the single source of truth for your data layer, and writing models by hand means remembering exact syntax for ids, defaults, and relations. This generator writes the boilerplate for you from a compact table definition syntax. To produce a schema:
The clearest use case is starting a new project or prototype. You have a mental model of the tables you need, and instead of recalling whether a field needs @default(autoincrement()) or how to write the back-reference on a relation, you describe it and let the generator emit valid Prisma syntax. That gets a working schema.prisma into place quickly so you can focus on business logic.
It is just as useful when porting an existing design. If you have database table definitions or an ORM model from another project, translating them into Prisma syntax is mechanical work with plenty of room for mistakes — unsupported types, missing relation sides, misnamed attributes. The generator handles the translation, auto-detecting attributes like @id, @default, @unique, and @updatedAt, and producing the relation fields Prisma needs on both sides. Teams starting a fresh data layer also benefit, because a generated schema gives everyone a consistent baseline to build on.
Your schema.prisma is a blueprint of your database — every model, every field, every relation between tables. If a schema generator ran remotely, it would receive that complete map of your data layer along with its relationships. This tool builds everything locally in your browser, so the table definitions you enter and the schema you copy out never leave your device.
That privacy is valuable whether the schema describes a prototype or production data. Drafting models, experimenting with relation shapes, and iterating on field types all happen privately, which means you can design your data layer freely without a third party accumulating a picture of your database structure.
Use the simple syntax: fieldName: Type @attribute (e.g., 'id: Int @id @default(autoincrement())').
Define one-to-one, one-to-many, or many-to-many relations between models using @relation.
Click Copy to grab the Prisma schema for your project's schema.prisma file.
Practical examples to help you get the most out of Prisma Schema Generator:
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}model User {
id Int @id @default(autoincrement())
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
author User @relation(fields: [authorId], references: [id])
authorId Int
}In Prisma, relations need proper @relation attributes. For one-to-many, the child model needs @relation(fields: [foreignKey], references: [id]).
Prisma supports only specific types: String, Int, Float, Boolean, DateTime, Json, Bytes, and enums. Types like 'VARCHAR' or 'TEXT' are not valid in Prisma schema.
Prisma schema is the configuration file (schema.prisma) that defines your database models, relations, and connection settings. It is the single source of truth for your Prisma project.
One-to-one, one-to-many, and many-to-many relations are all supported with proper @relation attribute generation.
Use the syntax: fieldName: Type @attribute. For example, 'id: Int @id @default(autoincrement())' defines a primary key field.
No. All schema generation happens locally in your browser.
Define tables with a simple syntax: field: type @attribute.
Supports one-to-one, one-to-many, and many-to-many relations with @relation.
Auto-detects @id, @default, @unique, @updatedAt, and other Prisma attributes.
Copy the generated Prisma schema to your project's schema.prisma file.
Prisma Schema Generator is useful in a variety of scenarios across different workflows:
Generating Prisma models from existing database table definitions
Creating initial Prisma schemas for new projects and prototypes
Converting table specifications into Prisma schema syntax for rapid development
Use @relation() to define foreign key relationships. Specify one-to-one, one-to-many, and many-to-many relations with proper field references.
Prisma supports String, Int, Float, Boolean, DateTime, and JSON types. Choose the type that matches your data and database capabilities.
Explore more tools in the Database workspace: