CLI
Commands
Complete reference for all CLI commands
Commands
Complete reference for all StackPatch CLI commands.
create
Creates a new StackPatch project from scratch.
npx stackpatch create [project-directory]Usage
# Interactive (prompts for project name)
npx stackpatch create
# With project name
npx stackpatch create my-app
# Using npm create
npm create stackpatch@latest my-app
# Using bunx
bunx create-stackpatch@latest my-appWhat Gets Created
- ✅ New Next.js project with TypeScript and Tailwind CSS
- ✅ Basic project structure
- ✅ All dependencies installed
- ✅ Welcome screen
After creation, add patches with npx stackpatch add.
add
Adds patches (features) to an existing Next.js project.
npx stackpatch add [patch-name]Available Patches
authorauth-ui- Complete authentication setup
Usage
# Interactive mode (select patch)
npx stackpatch add
# Add auth patch directly
npx stackpatch add auth
# Alternative name
npx stackpatch add auth-uiInteractive Mode
If you don't specify a patch name, you'll be prompted to:
- Select a patch from available options
- Choose OAuth providers (if installing auth):
- Google OAuth
- GitHub OAuth
- Email/Password (Credentials)
What Gets Added
When you add a patch, StackPatch:
- Detects your project structure (
app/vssrc/app/) - Copies files to correct locations
- Installs missing dependencies
- Updates your code (e.g., adds providers to
layout.tsx) - Tracks all changes in
.stackpatch/manifest.json
See Guides for details on available patches.
revert
Reverts a StackPatch installation, restoring your project to its previous state.
npx stackpatch revertUsage
# Revert the last installation
npx stackpatch revertWhat Happens
- Shows what will be reverted (patch name, files, timestamp)
- Asks for confirmation
- Removes all files added by StackPatch
- Restores all modified files to original state
- Uninstalls dependencies added by StackPatch
- Cleans up the
.stackpatchdirectory
Note: You must be in the directory where you ran
stackpatch add. The command uses.stackpatch/manifest.jsonto track changes.
See FAQ for information about reverting changes.
Command Examples
Create and Setup
# 1. Create a new project
npx stackpatch create my-app
# 2. Navigate to project
cd my-app
# 3. Add authentication
npx stackpatch add authAdd to Existing Project
# Navigate to your Next.js project
cd my-existing-project
# Add authentication
npx stackpatch add authRevert Installation
# Undo the last installation
npx stackpatch revertGlobal Options
These options work with any command:
--help, -h- Display help information--version, -V- Display CLI version--yes, -y- Skip prompts (forcreatecommand)
Next Steps
- Quick Start - Learn how to add your first patch
- Guides - Practical guides for common setups
- FAQ - Frequently asked questions