- Introduction
- Installation
- Usage
- Features
- AI-Powered Code Generation with MDC Templates
- Configuration
- License
PalJS is a powerful toolkit that accelerates GraphQL API development with Prisma. It provides code generation, admin interfaces, query optimization, and project scaffolding tools that let you build production-ready GraphQL APIs in minutes, not hours.
- ⏰ Rapid Development: Go from Prisma schema to production API in minutes
- 🛡️ Enterprise Ready: Built with type safety, security, and scalability in mind
- 🔌 Framework Agnostic: Works with Apollo Server, Express, Next.js, and more
- 📚 Well Documented: Comprehensive documentation and examples for every package
- 🌍 Active Community: Join thousands of developers building with PalJS
PalJS is organized as a monorepo with focused packages for different aspects of GraphQL development:
@paljs/cli | Command-line interface for project management and code generation | 📖 Docs |
@paljs/generator | Powerful code generation engine for GraphQL schemas, resolvers, and types | 📖 Docs |
@paljs/create | Project scaffolding with templates for multiple frameworks and architectures | 📖 Docs |
@paljs/nexus | Nexus plugin for Prisma integration with automatic field selection and admin schema | 📖 Docs |
@paljs/plugins | GraphQL plugins for query optimization, field selection, and SDL generation | 📖 Docs |
@paljs/admin | React admin UI components with Tailwind CSS, forms, tables, and CRUD operations | 📖 Docs |
@paljs/schema | Prisma schema manipulation, conversion tools, and TypeScript generation | 📖 Docs |
@paljs/utils | Common utilities for DMMF processing, schema validation, and helper functions | 📖 Docs |
@paljs/types | Comprehensive TypeScript type definitions for the entire PalJS ecosystem | 📖 Docs |
@paljs/display | Styled console output, progress indicators, and logging utilities for CLI tools | 📖 Docs |
PalJS follows a modular architecture that supports different GraphQL patterns:
graph TB
CLI[📱 PalJS CLI] --> Create[🚀 Project Creation]
CLI --> Generate[⚡ Code Generation]
Create --> Templates[📋 Templates]
Templates --> NextJS[Next.js + GraphQL]
Templates --> Apollo[Apollo Server]
Templates --> Modules[GraphQL Modules]
Generate --> Schema[🔧 Schema Processing]
Generate --> Nexus[🎯 Nexus Integration]
Generate --> SDL[📝 SDL Generation]
Generate --> Admin[🎨 Admin UI]
Schema --> Utils[🛠️ Utilities]
Schema --> Types[📊 Type Definitions]
Nexus --> Plugins[🔌 GraphQL Plugins]
Plugins --> Optimization[⚡ Query Optimization]
Transform 5 years of code generation expertise into AI-compatible instructions
PalJS now offers MDC (Model Data Context) Templates - comprehensive AI instructions that preserve all the power of our original generators while being maintenance-free and future-proof.
🚀 Future-Proof | No package dependencies to maintain or update |
🤖 AI-Compatible | Works with any AI model that can read instructions |
📚 Human-Readable | Easy to understand, customize, and extend |
⚡ Instant Setup | No installation required - just copy and use |
🎯 GraphQL Operations | Generate client-side GraphQL fragments, queries, and mutations | Frontend Development |
🎨 Admin Pages | Create React admin interfaces with Next.js support | Admin Dashboards |
⚡ Nexus Backend | Build type-safe GraphQL APIs with Nexus framework | Type-Safe APIs |
📝 SDL Backend | Generate SDL-first GraphQL schemas and resolvers | Schema-First APIs |
🛡️ Resolver Types | Create TypeScript type definitions for resolvers | Type Safety |
🏗️ GraphQL Modules | Build modular GraphQL with dependency injection | Enterprise Scale |
⚙️ Admin Settings | Generate configuration files for admin interfaces | UI Configuration |
Pick the template that matches your needs from the table above.
# Your Prisma schema
cat prisma/schema.prisma
# Choose configuration options
export OUTPUT_DIR="src/graphql"
export MODELS="User,Post,Comment"
# Example prompt for ChatGPT/Claude/etc:
"I need you to generate GraphQL operations for my Prisma models.
Here's the MDC template: [paste template content]
Here's my Prisma schema: [paste schema]
Configuration:
- Output directory: src/graphql
- Models: User, Post, Comment
- Exclude fields: createdAt, updatedAt
- Generate TypeScript
Please follow the exact patterns in the template."
The AI will generate the same high-quality code that PalJS generators created, but without any package dependencies!
Input: Simple blog schema with User and Post models
Output: Complete GraphQL operations, admin pages, or backend APIs
// Generated GraphQL operations
export const USER_FRAGMENT = gql`
fragment UserFragment on User {
id
email
name
posts {
id
title
}
}
`;
export const FIND_MANY_USERS = gql`
query FindManyUsers($where: UserWhereInput) {
findManyUsers(where: $where) {
...UserFragment
}
}
${USER_FRAGMENT}
`;
Transitioning from the original generators is seamless:
Original Generator | MDC Template | Status |
---|---|---|
@paljs/generator → GraphQL |
GraphQL Operations | ✅ 100% Compatible |
@paljs/generator → Admin |
Admin Pages | ✅ 100% Compatible |
@paljs/generator → Nexus |
Nexus Backend | ✅ 100% Compatible |
@paljs/generator → SDL |
SDL Backend | ✅ 100% Compatible |
Traditional Generators | MDC Templates |
---|---|
📦 Package dependencies | 🚀 Zero dependencies |
🔄 Version compatibility issues | ⚡ Always compatible |
🛠️ Maintenance overhead | 🎯 Maintenance-free |
🏗️ Fixed patterns | 🎨 AI-adaptable patterns |
📅 Periodic updates needed | 🔮 Future-proof |
- Complete Documentation - Comprehensive guide and usage instructions
- Practical Examples - Real-world scenarios with sample schemas
- Migration Guide - Step-by-step transition guide
Choose one of the following installation methods:
# Install PalJS CLI globally to use the 'pal' command
npm install -g @paljs/cli
# After global installation, the 'pal' binary is available system-wide
pal --help
# Use npx to run commands without global installation
npx @paljs/cli --help
# Create a new full-stack project
pal create my-graphql-app
# Choose your preferred setup:
# ✔ Project template: full-stack-nextjs
# ✔ UI framework: Tailwind CSS + PrismaAdmin UI
# ✔ Package manager: yarn
# ✔ Initialize git: yes
cd my-graphql-app
yarn dev
# Create a new full-stack project without global installation
npx @paljs/cli create my-graphql-app
# Same interactive setup process follows
cd my-graphql-app
yarn dev
# After defining your Prisma schema
pal generate
# Generates:
# ✅ GraphQL schema with all CRUD operations
# ✅ Type-safe resolvers
# ✅ Admin interface pages
# ✅ Query optimization utilities
# After defining your Prisma schema
npx @paljs/cli generate
# Same generated output
-
Install PalJS CLI
npm install -g @paljs/cli
-
Create a new project
pal create my-app --example full-stack-nextjs --framework "Tailwind CSS + PrismaAdmin UI"
-
Define your data model
// prisma/schema.prisma model User { id Int @id @default(autoincrement()) email String @unique name String? posts Post[] } model Post { id Int @id @default(autoincrement()) title String content String? published Boolean @default(false) author User @relation(fields: [authorId], references: [id]) authorId Int }
-
Generate GraphQL API
cd my-app pal generate
-
Start developing
npm run dev
pal create my-nexus-api --example apollo-nexus-schema
Perfect for: Type-safe GraphQL with excellent TypeScript integration
pal create my-sdl-api --example apollo-sdl-first
Perfect for: Schema-first development with flexible resolver patterns
pal create my-modular-api --example graphql-modules
Perfect for: Large, scalable applications with modular architecture
pal create my-fullstack-app --example full-stack-nextjs
Perfect for: Complete web applications with admin interfaces
- Generate complete GraphQL APIs from Prisma schemas
- Instant admin interfaces for data management
- Built-in authentication and authorization patterns
- Multi-schema support for microservices
- Type-safe code generation
- Scalable GraphQL architectures
- Best practice templates and examples
- Comprehensive documentation
- Community support and tutorials
- Migrate REST APIs to GraphQL
- Add admin interfaces to existing databases
- Optimize query performance automatically
# Update all PalJS packages
npm update @paljs/cli @paljs/generator @paljs/nexus
# Regenerate with latest templates
pal generate --force
# Generate Prisma migration
npx prisma migrate dev
# Regenerate GraphQL schema
pal generate
- 🔥 Instant CRUD Generation - Auto-generate complete GraphQL schemas, resolvers, and mutations
- 🎨 Admin UI Components - Ready-to-use React admin interfaces with full CRUD operations
- ⚡ Query Optimization - Automatic field selection and query optimization for better performance
- 🏗️ Project Scaffolding - Create full-stack applications with modern frameworks and best practices
- 🎯 Type Safety - Full TypeScript support across all packages and generated code
- 🔧 Multiple Architectures - Support for Nexus, SDL-first, and GraphQL Modules approaches
- Automatic field selection based on GraphQL queries
- Reduced database load with smart relationship loading
- Built-in query complexity analysis
- Input validation and sanitization
- Rate limiting and query depth limiting
- Secure authentication patterns
- Built-in performance metrics
- Error tracking and logging
- Development and production optimizations
- Documentation - Comprehensive guides and API references
- Examples - Real-world project templates
- Blog - Tutorials, tips, and best practices
- Discord - Join our community for help and discussions
- GitHub Issues - Report bugs and request features
- Discussions - Ask questions and share ideas
We welcome contributions! See our Contributing Guide for details.
Need enterprise support? Contact us at [email protected]
module.exports = {
schema: './prisma/schema.prisma',
backend: {
generator: 'nexus', // 'nexus' | 'sdl' | 'graphql-modules'
output: './src/graphql',
excludeFields: ['password', 'hash'],
excludeModels: [{ name: 'Log', queries: true, mutations: false }],
},
frontend: {
admin: {
models: ['User', 'Post', 'Category'],
output: './src/admin/pages',
},
},
};
module.exports = {
multiSchema: true,
schemas: {
user: {
schema: './prisma/user.prisma',
backend: { generator: 'nexus', output: './src/graphql/user' },
},
blog: {
schema: './prisma/blog.prisma',
backend: { generator: 'sdl', output: './src/graphql/blog' },
},
},
};
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by the PalJS team