@launch77-shared/plugin-auth
v0.0.1
Published
Authentication plugin with user registration, login, and session management
Readme
Launch77 Auth Plugin
Complete authentication solution for Launch77 applications with mock API support for development.
Installation
launch77 plugin:install authFeatures
- 🔐 User Authentication - Registration, login, and logout functionality
- 🎭 Mock API Mode - Built-in mock API for rapid development
- 🔑 Token Management - JWT-like tokens with automatic refresh
- 🛡️ Protected Routes - Easy route protection with auth hooks
- 📝 Form Components - Pre-built login and register forms
- 💾 Session Persistence - Remember me functionality
- ✅ Validation - Comprehensive form and password validation
- 🎨 UI Ready - Styled with @launch77/ui components
What Gets Installed
After installation, the plugin will:
- Copy auth module to
src/modules/auth/with components, hooks, and services - Wrap your app with
AuthProviderinapp/layout.tsx - Create auth pages:
/login,/register,/dashboard,/forgot-password - Add environment config to
.env.localfor mock mode - Create showcase page at
/plugins/authwith examples
Quick Start
1. Install and build
launch77 plugin:install auth
npm run dev2. Seed demo users (optional)
Visit /plugins/auth and click "Seed Demo Users"
3. Test authentication
- Visit
/registerto create an account - Visit
/loginto sign in - Visit
/dashboardto see protected content
Important: Hook Usage
- Use
useAuth()to read auth state without redirects (e.g., conditional rendering) - Use
useRequiredAuth()to protect routes with automatic login redirect - Only call
useRequiredAuth()once per page to avoid duplicate redirects
See the full documentation in src/modules/auth/README.md after installation for detailed usage patterns.
Test Credentials (Mock Mode)
- Email: [email protected]
- Password: demoPassword123!
Development
Building
npm run buildTesting
npm run typecheckDocumentation
See src/modules/auth/README.md for complete API documentation after installation.
License
UNLICENSED
