Quick Start
Create your first StackPatch project in minutes
Philosophy
- Own your code: Every line of code is yours to modify and customize
- Zero vendor lock-in: No SaaS dependencies, everything runs on your infrastructure
- Production-ready: Battle-tested patterns, not toy examples
- Incremental adoption: Add features to existing projects seamlessly
- Fully reversible: Track and revert any installation safely
Get Started
Prerequisites
- Node.js 18+ - Download from nodejs.org
- Bun 1.0+ (optional) - Download from bun.sh - if you want to use Bun
- Next.js project (App Router) - Create new or use existing
Add to Existing Project
Navigate to your Next.js project and run:
npx stackpatch add authnpm create stackpatch@latestbunx stackpatch add authFollow the interactive prompts to select OAuth providers (Google, GitHub, Email/Password).
Create New Project
Create a new StackPatch project from scratch:
npx stackpatch create my-appnpm create stackpatch@latest my-appbunx create-stackpatch@latest my-appThen add patches to your new project:
cd my-app
npx stackpatch add authcd my-app
npx stackpatch add authcd my-app
bunx stackpatch add authCommon Setups
Authentication with Google & GitHub
Add authentication with multiple OAuth providers:
npx stackpatch add auth
# Select: Google, GitHubnpm create stackpatch@latest
# Then: npx stackpatch add authbunx stackpatch add auth
# Select: Google, GitHubEmail/Password Authentication
Add email/password authentication (demo mode):
npx stackpatch add auth
# Select: Email/Passwordnpm create stackpatch@latest
# Then: npx stackpatch add authbunx stackpatch add auth
# Select: Email/PasswordRevert Installation
If you need to undo an installation:
npx stackpatch revertnpx stackpatch revertbunx stackpatch revertWhat Gets Added
When you run npx stackpatch add auth, StackPatch automatically:
- ✅ Detects your project structure (
app/vssrc/app/) - ✅ Adds authentication pages (
/auth/login,/auth/signup) - ✅ Configures NextAuth.js with selected providers
- ✅ Creates protected route components
- ✅ Sets up middleware for route protection
- ✅ Installs dependencies (
next-auth,react-hot-toast) - ✅ Updates your
layout.tsxwith providers - ✅ Uses your TypeScript path aliases
- ✅ Tracks all changes for safe reversion