|
| 1 | +--- |
| 2 | +name: authentication |
| 3 | +description: Complete authentication system with Better Auth, email verification, password reset, protected routes, and account management. |
| 4 | +--- |
| 5 | + |
| 6 | +# Authentication |
| 7 | + |
| 8 | +Complete authentication system with Better Auth, email verification, password reset, protected routes, and account management. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +Complete these recipes first (in order): |
| 13 | + |
| 14 | +### Type-Safe Environment Configuration |
| 15 | + |
| 16 | +Type-safe environment variable validation using Zod with a Drizzle-like schema API. Supports server/public fields, feature flags, either-or constraints, and client-side protection. |
| 17 | + |
| 18 | +```bash |
| 19 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/config-schema-setup |
| 20 | +``` |
| 21 | + |
| 22 | +### Neon + Drizzle Setup |
| 23 | + |
| 24 | +Connect a Next.js app to Neon Postgres using Drizzle ORM with optimized connection pooling for Vercel serverless functions. |
| 25 | + |
| 26 | +```bash |
| 27 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/neon-drizzle-setup |
| 28 | +``` |
| 29 | + |
| 30 | +### Next.js on Vercel |
| 31 | + |
| 32 | +Create a Next.js app running on Bun, configure the development environment, and deploy to Vercel with automatic deployments on push. |
| 33 | + |
| 34 | +```bash |
| 35 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/nextjs-on-vercel |
| 36 | +``` |
| 37 | + |
| 38 | +### Shadcn UI & Theming |
| 39 | + |
| 40 | +Add Shadcn UI components with dark mode support using next-themes. Includes theme provider and CSS variables configuration. |
| 41 | + |
| 42 | +```bash |
| 43 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/shadcn-ui-setup |
| 44 | +``` |
| 45 | + |
| 46 | +## Cookbook - Complete These Recipes in Order |
| 47 | + |
| 48 | +### Resend Setup |
| 49 | + |
| 50 | +Configure Resend for transactional emails like password resets and email verification. |
| 51 | + |
| 52 | +```bash |
| 53 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/resend-setup |
| 54 | +``` |
| 55 | + |
| 56 | +### Better Auth Setup |
| 57 | + |
| 58 | +Add user authentication using Better Auth with Drizzle ORM and Neon Postgres. Base setup with email/password authentication. |
| 59 | + |
| 60 | +```bash |
| 61 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/better-auth-setup |
| 62 | +``` |
| 63 | + |
| 64 | +### Better Auth Emails |
| 65 | + |
| 66 | +Add email verification, password reset, and account management emails to Better Auth using Resend. |
| 67 | + |
| 68 | +```bash |
| 69 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/better-auth-emails |
| 70 | +``` |
| 71 | + |
| 72 | +### Better Auth Components |
| 73 | + |
| 74 | +Add UI components and pages for authentication flows including sign in, sign up, forgot password, reset password, and email verification. |
| 75 | + |
| 76 | +```bash |
| 77 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/better-auth-components |
| 78 | +``` |
| 79 | + |
| 80 | +### Better Auth Profile & Account |
| 81 | + |
| 82 | +Add a complete account settings page with profile editing, password changes, email updates, session management, and account deletion. |
| 83 | + |
| 84 | +```bash |
| 85 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/better-auth-profile |
| 86 | +``` |
| 87 | + |
| 88 | +### Better Auth Protected Routes |
| 89 | + |
| 90 | +Add server-side route protection to enforce authentication on specific pages while keeping others public. |
| 91 | + |
| 92 | +```bash |
| 93 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/better-auth-protected-routes |
| 94 | +``` |
| 95 | + |
| 96 | +### Working with Authentication |
| 97 | + |
| 98 | +Use Better Auth for client and server-side authentication. Covers session access, protected routes, sign in/out, and fetching user data. |
| 99 | + |
| 100 | +```bash |
| 101 | +curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/using-authentication |
| 102 | +``` |
0 commit comments