@paljs/cli
Introduction
A powerful command-line interface for generating full-stack applications with Prisma, GraphQL, and modern frontend frameworks. The PalJS CLI automates the creation of CRUD operations, admin interfaces, and GraphQL schemas.
Installation
Global Installation
Project Installation
Quick Start
After installation, create a new project:
Commands Overview
The PalJS CLI provides three main commands:
Command | Description | Type |
---|---|---|
create | Create new project | Interactive |
generate | Generate CRUD operations | Flag-based |
schema | Schema conversion utilities | Flag-based |
Usage
pal create
Create a new full-stack application with Prisma and GraphQL through an interactive setup process.
Interactive Setup Process:
The create
command runs an interactive setup that will prompt you for:
- Project Name - The name of your new project
- Project Description - Brief description of your project
- Author - Project author name
- Repository - Git repository URL
- Use Git - Whether to initialize a git repository
- Package Manager - Choose between npm or yarn
- Skip Installation - Whether to skip package installation
- Example Template - Choose from available project templates:
full-stack-nextjs
- Complete Next.js application with Prismaapollo-nexus-schema
- Apollo Server with Nexus schema-first approachapollo-sdl-first
- Apollo Server with SDL-first approachgraphql-modules
- GraphQL Modules architecture
Additional Options for Full-Stack Next.js:
If you select the full-stack-nextjs
template, you'll be prompted for:
- UI Framework - Choose from:
- Material UI
- Material UI + PrismaAdmin UI
- Tailwind CSS
- Tailwind CSS + PrismaAdmin UI
- Chakra UI
- Chakra UI + PrismaAdmin UI
- Multi-Schema Support - Whether to use multi-schema template
Example Session:
pal generate [models] [type]
Generate CRUD operations, admin pages, and GraphQL queries/mutations.
Arguments:
models
- Comma-separated list of model names (optional)type
- Type of files to generate:crud
,queries
,mutations
,admin
,graphql
Available Flags:
-c, --config <file>
- Custom config file name (default:pal.config
)-s, --schema <name>
- Schema name from config file-m, --multi
- Work with multi-schema configuration-a, --autoComplete <path>
- Generate CLI auto-completion for oh-my-zsh
Examples:
Generate everything for all models:
Generate for specific models:
Generate specific types:
Generate admin pages only:
Use custom config file:
Multi-schema mode:
pal schema <converter>
Convert and manipulate Prisma schema files.
Arguments:
converter
- Conversion type:json
,typescript
,camel-case
Available Flags:
-o, --output-path <path>
- Output folder path (default:src/
)-t, --type <type>
- Output file type for JSON conversion:js
,ts
,json
(default:ts
)-s, --schema <path>
- Custom schema file path
Examples:
Convert schema to JSON:
Convert to TypeScript types:
Convert snake_case to camelCase:
Convert to TypeScript with custom output:
Convert to JSON as JavaScript file:
Convert specific schema file:
Development Server
To run your generated application:
Complete Project Setup Example
Here's a complete workflow for setting up a new project:
Command Reference
Global Options
Option | Description | Default |
---|---|---|
--help | Show help | - |
--version | Show version | - |
Command Aliases
Command | Alias | Description |
---|---|---|
create | c | Create new project |
generate | g | Generate CRUD operations |
schema | s | Schema utilities |
Features
- Interactive Project Creation: Guided setup process for new projects
- CRUD Generation: Automatic creation of GraphQL operations
- Multiple Templates: Choose from various project templates
- UI Framework Support: Support for popular UI frameworks
- Type Safety: Full TypeScript support throughout
- Package Manager Agnostic: Works with npm, yarn, and pnpm
- Multi-Schema Support: Handle multiple Prisma schemas
- Schema Conversion: Convert schemas to different formats