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

  • Automatic type inference: String, Int, Float, Boolean, DateTime (ISO date detection)
  • Nested objects are extracted as separate Prisma models with relations
  • Array fields are mapped to Prisma array types or relation lists
  • Configurable: auto-generate @id, @createdAt/@updatedAt, and @unique for email fields
  • Smart singularization of array field names for child model naming

How to use

  1. Paste your JSON data or click Sample to load example data.
  2. Configure options: toggle @id generation, timestamps, and email uniqueness.
  3. Copy the generated Prisma schema to your clipboard and paste it into your schema.prisma file.

Tips & Best Practices

  • Paste your code directly or use the file upload feature for larger files.
  • The tool preserves your original input — you can always go back and modify it.
  • Use the output directly in your IDE or build pipeline.
  • Check the formatted output for any warnings or validation messages.
  • All processing is client-side, making it safe for proprietary code.

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.