MDC Templates AI-Powered
AI-readable templates that preserve PalJS generator patterns. Generate the same high-quality, consistent code using AI models instead of traditional code generators.
What are MDC Templates? These are comprehensive instruction files that AI models can read to generate the same code patterns that the original PalJS generators created. No package dependencies required!
Overview
PalJS was a powerful toolkit for building NodeJS, Prisma, GraphQL, and React applications. These MDC (Model Data Context) templates preserve all the generator patterns and allow AI models to create the same high-quality, consistent code without needing the original generator packages.
✨ Benefits
- • No package dependencies to maintain
- • Works with any AI model
- • Human-readable and editable instructions
- • Future-proof and adaptable
- • Consistent code generation patterns
🎯 Use Cases
- • Generate GraphQL operations for frontends
- • Create admin interfaces and CRUD pages
- • Build type-safe GraphQL APIs
- • Generate resolver types and schemas
- • Create modular GraphQL architectures
Available Templates
1. Prisma GraphQL Generator
Purpose: Generate GraphQL fragments, queries, and mutations for client-side operations
What it generates:
- GraphQL fragments for each Prisma model
- Complete CRUD queries (findUnique, findMany, findCount)
- Complete CRUD mutations (create, update, delete, updateMany, deleteMany)
- Properly formatted .graphql files
Use case: Frontend applications that need GraphQL operations for Prisma models
Example Output Structure:
2. Prisma Admin Pages Generator
Purpose: Generate React admin interface pages for database management
What it generates:
- React components for each Prisma model
- Support for both Next.js Pages Router and App Router
- Admin layout components
- PrismaTable component integration
Use case: Building admin dashboards and CRUD interfaces
Example Output Structure:
3. Prisma Nexus Generator
Purpose: Generate Nexus GraphQL schema with type-safe resolvers
What it generates:
- Nexus object type definitions
- Type-safe GraphQL resolvers
- Complete query and mutation implementations
- Input types and enums
- Proper TypeScript/JavaScript module structure
Use case: Backend GraphQL APIs using the Nexus framework
4. Prisma SDL Generator
Purpose: Generate GraphQL Schema Definition Language and resolvers
What it generates:
- SDL type definitions
- Resolver implementations
- Input types and enums in SDL format
- TypeScript type definitions for resolvers
- Proper module structure for schema composition
Use case: Backend GraphQL APIs using SDL-first approach
5. Prisma Resolver Types Generator
Purpose: Generate TypeScript type definitions for GraphQL resolvers
What it generates:
- Type-safe resolver function signatures
- Complete TypeScript interfaces for all resolvers
- Input/output type definitions
- Enum type definitions
- Context and argument typing
Use case: Adding type safety to SDL-based GraphQL resolvers
6. Prisma GraphQL Modules Generator
Purpose: Generate modular GraphQL schema using GraphQL Modules framework
What it generates:
- GraphQL Modules with dependency injection
- Modular type definitions and resolvers
- Application composition files
- Provider integration patterns
- Module-based architecture
Use case: Large-scale GraphQL APIs requiring modularity and dependency injection
7. Prisma Admin Settings Generator
Purpose: Generate admin interface configuration files
What it generates:
- JSON configuration files for admin UIs
- Field-level permissions and display settings
- Model operation permissions
- UI customization options
- Smart merging with existing settings
Use case: Configuring admin dashboards and management interfaces
Quick Start Guide
Step 1: Choose Your Template
Select the template that matches your needs from the list above. Each template is designed for specific use cases and generates different types of code.
Step 2: Prepare Your Context
When working with an AI model, provide:
- The relevant MDC template (copy the entire content)
- Your Prisma schema (the schema.prisma file)
- Configuration options (specify any custom settings)
- Output preferences (file structure, naming conventions)
Step 3: Example AI Prompt
Configuration Options
All generators support these common configuration options:
Real-World Example
Let's see how to use the GraphQL Generator template with a blog schema:
Sample Prisma Schema
AI Prompt Example
Expected Generated Output (User.graphql)
Migration from Original Generators
If you're migrating from the original PalJS generators:
- Identify which generators you were using - Check your code for imports from
@paljs/generator
- Find the corresponding MDC template - Use the mapping in the table above
- Extract your existing configuration - Look for GeneratorOptions in your code
- Use the template with an AI model - Replace the generator package calls with AI prompts
Benefits of MDC Approach
Maintainability
- No package dependencies to maintain
- AI models can understand and modify patterns
- Instructions are human-readable and editable
Flexibility
- Easy to customize patterns for specific needs
- Can combine multiple templates for complex scenarios
- AI can adapt patterns to new frameworks or requirements
Future-Proof
- Works with any AI model that can read instructions
- Not tied to specific package versions or Node.js versions
- Easy to extend or modify as needs change
Need Help? Check out the complete examples and detailed documentation on GitHub or explore the individual template pages for step-by-step guides.
Next Steps
- Explore the individual template pages for detailed instructions and examples
- Try the templates with your own Prisma schema
- Customize the templates for your specific use cases
- Share feedback and improvements with the community