Prisma Schema Generator
Generate Prisma ORM model definitions from JSON data. Automatically detects field types including String, Int, Float, Boolean, DateTime, arrays, and nested objects as relations.
Input JSON
Prisma Schema
Paste JSON on the left to generate Prisma schema
Prisma Schema Generator
Generate Prisma ORM model definitions from JSON data. Automatically detects field types including String, Int, Float, Boolean, DateTime, arrays, and nested objects as relations.
Features
- Generate Prisma schema files from JSON sample data
- Includes datasource and generator blocks (configurable provider: postgresql / mysql / sqlite / sqlserver / mongodb)
- Type inference: String / Int / Float / Boolean / DateTime, arrays, nested objects as separate models
- Auto-add id field, createdAt / updatedAt timestamps, @unique on email-shaped fields
- Output is paste-ready into `prisma/schema.prisma`
How to use
- Paste your JSON data or click Sample to load example data.
- Configure options: toggle @id generation, timestamps, and email uniqueness.
- Copy the generated Prisma schema to your clipboard and paste it into your schema.prisma file.
Tips & Best Practices
- Pick the datasource provider that matches your real database — datatypes (e.g. citext, jsonb) differ across providers.
- Relations between nested models are scaffolded as arrays/foreign keys but `@relation` annotations may need manual tweaking.
- The DATABASE_URL placeholder reads from your environment — keep the env block in `.env` outside source control.
- For complex schemas (composite keys, custom check constraints), edit the generated file and re-run `prisma generate`.
- Always run `prisma format` and `prisma validate` after pasting to catch any remaining issues.
FAQ
How does the tool detect DateTime fields?
The tool checks if string values match the ISO 8601 date format (e.g., 2024-01-15T10:30:00.000Z). If a string is a valid ISO date, it is mapped to Prisma's DateTime type instead of String.
How are nested objects handled?
Each nested object is extracted into its own Prisma model with a PascalCase name derived from the property key. For example, an 'address' field containing an object becomes a separate 'Address' model.
How are arrays converted to Prisma types?
Primitive arrays (strings, numbers) become Prisma array types like String[] or Int[]. Arrays of objects generate a separate model for the child type and create a relation list (e.g., Post[]).
Can I use the generated schema directly in my project?
The generated schema provides a solid starting point. You may need to add relation annotations (@relation), indexes (@index), or adjust field types for your specific database. Copy the output into your schema.prisma file and refine as needed.
Is my data sent to any server?
No. All schema generation happens entirely in your browser. Your JSON data never leaves your device, making it safe to use with proprietary or sensitive data structures.
What Prisma features does this tool support?
The tool generates basic Prisma models with type inference, @id with autoincrement, @default(now()) for createdAt, @updatedAt for updatedAt, and @unique for email fields. For advanced features like composite keys, enums, or custom relations, you can extend the generated schema manually.