Cursor Prompt: Add User Authentication
When to Use This Prompt
Use this when your app needs user accounts. Apply it early in development — authentication affects routing, data access, and UI throughout the app.
The Prompt
Add complete user authentication to this Next.js app: 1. Sign up page with email/password 2. Login page with email/password 3. Google OAuth sign-in button 4. Magic link (passwordless) option 5. Protected route middleware 6. User profile page with avatar and settings 7. Password reset flow 8. Session management with refresh tokens Use Supabase Auth. Add a `useUser` hook that provides the current user context throughout the app. Show loading states during auth checks. Redirect unauthenticated users to /login.
What to Customize
Remove OAuth providers you don't need. Add specific providers (GitHub, Discord) if needed. Adjust the protected routes list.
Expected Output
Complete auth flow with signup, login, logout, and protected routes. Supabase Auth handles the heavy lifting — expect 5-8 files generated.