Repository navigation
v0.4.0 - Server Actions Support
🎉 Server Actions Support for Next.js 15+
Major new feature release adding first-class support for Next.js 15 Server Actions!
🚀 New Features
Server Actions Helpers:
getServerSession(cookieSecret)- Get current session in Server Actions/ComponentsrequireAuth(cookieSecret)- Require authentication with helpful errors- Full TypeScript support with proper type inference
Example Code:
'use server';
import { requireAuth } from '@lance0/latch';
export async function getProfile() {
const user = await requireAuth(process.env.LATCH_COOKIE_SECRET!);
return { name: user.name, email: user.email };
}📚 Documentation & Examples
- New Guide: docs/SERVER_ACTIONS.md - Comprehensive patterns and best practices
- Example Actions:
apps/example-app/app/actions/profile.ts- Read operationsapps/example-app/app/actions/updateSettings.ts- Mutations & form actions
- Live Demo:
/dashboard/server-actions-demopage with interactive examples - README: Updated with Server Actions quick start
🔧 Error Handling
- New
LATCH_UNAUTHORIZEDerror code - Helpful error messages with solutions
- Clear guidance on handling auth errors in Server Actions
🧪 Tests
- 7 new tests for Server Actions helpers
- 142 total tests passing
- Full coverage of auth scenarios
📊 Roadmap Progress
✅ Completed high-priority item: Server Actions Patterns (15 hours estimated)
This was identified as critical for v1.0 GA and is now complete!
📦 Installation
npm install @lance0/latch@0.4.0🔄 Migration
Breaking Changes: None
Required Changes: None
This release is 100% backward compatible. New helpers are opt-in additions.
🎯 When to Use
Use Server Actions when:
- Form submissions and mutations
- Simple authenticated data fetching
- Collocated with UI components
- Want end-to-end TypeScript types
Use API Routes when:
- OAuth callbacks (like Latch uses)
- Webhooks from external services
- Public REST APIs
- Rate limiting and complex middleware
See the Server Actions guide for detailed decision matrix.
🙏 What's Next
With Server Actions support complete, the next priorities for v1.0 are:
- Enhanced validation guards (strict tenant/issuer validation)
- Example app presets (commercial vs GCC-High)
- Security audit preparation