Pattern API Reference

Detailed API documentation for working with SeanStack patterns programmatically.

Pattern Structure

Every pattern follows a standardized structure for consistency and AI compatibility:

pattern-name/
├── pattern.json          # Pattern metadata and configuration
├── files/               # Pattern files to copy
│   ├── components/      # React components
│   ├── hooks/          # Custom hooks
│   ├── lib/            # Utility functions
│   └── types/          # TypeScript definitions
├── dependencies.json    # Required dependencies
├── README.md           # Pattern documentation
└── examples/           # Usage examples
    ├── basic.tsx
    └── advanced.tsx

pattern.json Schema

Metadata file that describes the pattern and its requirements

{
  "name": "auth-form",
  "version": "1.2.0",
  "description": "Complete authentication form with validation",
  "author": "SeanStack Team",
  "license": "MIT",
  
  "category": "authentication",
  "tags": ["auth", "form", "validation", "ui"],
  "difficulty": "beginner",
  
  "framework": {
    "nextjs": ">=14.0.0",
    "react": ">=18.0.0"
  },
  
  "ai": {
    "description": "Authentication form component with sign in/up",
    "usage": "Used for user authentication flows",
    "customization": "Styling, validation rules, social providers",
    "context": "Requires Supabase auth setup"
  },
  
  "files": [
    {
      "source": "components/auth-form.tsx",
      "destination": "components/auth/auth-form.tsx",
      "type": "component"
    },
    {
      "source": "hooks/use-auth.ts",
      "destination": "hooks/use-auth.ts",
      "type": "hook"
    }
  ],
  
  "dependencies": {
    "required": [
      "@supabase/supabase-js",
      "react-hook-form"
    ],
    "optional": [
      "zod",
      "lucide-react"
    ]
  },
  
  "configuration": {
    "environment": [
      "NEXT_PUBLIC_SUPABASE_URL",
      "NEXT_PUBLIC_SUPABASE_ANON_KEY"
    ],
    "setup": [
      "Configure Supabase auth providers",
      "Set up database policies"
    ]
  }
}

Pattern Categories

Authentication

  • • Sign in/up forms
  • • Password reset
  • • Social login
  • • Protected routes

UI Components

  • • Data tables
  • • Dashboard layouts
  • • Navigation menus
  • • Form components

Data Management

  • • API routes
  • • Database hooks
  • • Caching strategies
  • • Real-time updates

Features

  • • Settings pages
  • • Billing integration
  • • File uploads
  • • Notification systems

Development

  • • Testing utilities
  • • Build configurations
  • • Deployment scripts
  • • CI/CD pipelines

Performance

  • • Image optimization
  • • Code splitting
  • • Caching strategies
  • • Bundle analysis

Creating Custom Patterns

Learn how to create and publish your own patterns to the registry: