Skip to content

v0.4.4 - Enhanced CLI Scaffold Commands

Choose a tag to compare

@lance0lance0 released this 17 Nov 17:40
· 7 commits to master since this release

🛠️ Enhanced CLI Developer Experience

This release significantly improves the command with new capabilities.

✨ New Scaffold Options

Interactive Menu:

npx @lance0/latch-cli scaffold

Choose from:

  • API Routes - Auth endpoints (/api/latch/*)
  • Proxy (Next.js 16) - Session validation middleware
  • Auth Wrapper - lib/auth.ts helper functions
  • All of the Above - Complete setup

Or use CLI flags:

npx @lance0/latch-cli scaffold --type proxy    # Generate proxy.ts
npx @lance0/latch-cli scaffold --type wrapper  # Generate lib/auth.ts
npx @lance0/latch-cli scaffold --type all      # Everything

📦 What Gets Generated

proxy.ts (Next.js 16 compatible):

  • ✅ No runtime export (avoids build errors)
  • ✅ Proper session validation (checks session.sub)
  • ✅ Customizable public routes
  • ✅ Works with Next.js 16 automatically

lib/auth.ts (Recommended wrapper pattern):

  • getCurrentUser() with React cache
  • requireAuth() guard function
  • ✅ TODO comments for database sync
  • ✅ JIT user provisioning pattern

🎯 Why These Additions?

Based on real production feedback:

  • Users need a reference proxy.ts for Next.js 16
  • Wrapping pattern should be easier to set up
  • One command should generate everything needed

📖 Links