{"repo":"deveripon/Next-Nest-Better-Auth","free":true,"listed":false,"github":"https://github.com/deveripon/Next-Nest-Better-Auth","clone":"git clone https://github.com/deveripon/Next-Nest-Better-Auth.git","description":"A high-performance, type-safe, full-stack starter kit featuring Next.js 16, Nest.js 11, and Better-Auth. This kit implements a robust \"Shared Database Session\" architecture, allowing seamless authentication across a decoupled frontend and backend.","language":"TypeScript","stars":28,"topics":["better-auth","nestjs","nextjs","postgres","prisma","monorepo"],"license":"MIT","category":"databases-storage","readme_excerpt":"--- 🚀 Next-Nest-Better-Auth Starter Kit A high-performance, type-safe, full-stack starter kit featuring Next.js 16 , Nest.js 11 , and Better-Auth . This kit implements a robust \"Shared Database Session\" architecture, allowing seamless authentication across a decoupled frontend and backend. 🏗️ Architecture Overview Unlike traditional JWT-based architectures, this kit uses Better-Auth with a shared database strategy. 1. Frontend (Next.js): Handles user login, signup, and session management. It stores the session token in an httpOnly cookie. 2. Proxying: Next.js proxies API requests to Nest.js, ensuring cookies are sent automatically without CORS headaches. 3. Backend (Nest.js): Uses a custom AuthGuard that validates the session token directly against the shared database using the Better-Auth API. --- 🛠️ Tech Stack Frontend: Next.js 15 (App Router), Tailwind CSS, Better-Auth Client. Backend: Nest.js 11, Better-Auth Node SDK. Database: PostgreSQL with Prisma ORM . Validation: Class-validator, Zod. --- 🚦 Getting Started 1. Environment Configuration Create a .env file in both your frontend and backend directories. Backend (.env) Frontend (.env) 2. Next.js Proxy Setup To handle cookies correctly, we use Next.js rewrites in next.config.ts : --- 🔒 Authentication Implementation The Hybrid AuthGuard The included AuthGuard in Nest.js supports both Browser Cookies and Postman Bearer Tokens . Detailed Logging The Guard includes a detailed logger to track the authentication lifecycle: ","default_branch":null,"files":null,"tree":[],"storefront":"/r/deveripon","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/deveripon/Next-Nest-Better-Auth/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}