A JavaScript/TypeScript library for programmatically building and printing Prisma Schema DSL ASTs. Current stable version 2.2.0 allows creating enums, models, fields, and data sources with validation and type safety. Exports a print() function that formats the AST into a valid Prisma schema file using prisma-format. Key differentiator: provides a type-safe builder pattern instead of string manipulation, with full TypeScript support. Active development on GitHub under Amplication.
npm install prisma-schema-dslNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates building a complete Prisma schema with enum, model, scalar fields, and data source, then printing the result.
Use await print(schema) or .then() to get the string.
Ensure names are valid Prisma identifiers: start with letter or underscore, alphanumeric/underscore only.
Use the object parameter: createDataSource({ name: 'db', provider: 'postgresql', url: '...' })Switch to ES modules by setting type: module in package.json, or use dynamic import() with .mjs extension.
Add await before print(schema) or use .then() on the returned Promise.
Use import() or switch your project to ES modules.
Update name to follow Prisma identifier rules (letters, digits, underscores; cannot start with digit).