<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Salman Shahriar</title>
    <description>The latest articles on DEV Community by Salman Shahriar (@salmanshahriar).</description>
    <link>https://dev.to/salmanshahriar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1951722%2F6c136fda-088e-4813-ba06-de1af03134ea.jpeg</url>
      <title>DEV Community: Salman Shahriar</title>
      <link>https://dev.to/salmanshahriar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/salmanshahriar"/>
    <language>en</language>
    <item>
      <title>I built an opensource production-ready NEXT.JS STARTER KIT!</title>
      <dc:creator>Salman Shahriar</dc:creator>
      <pubDate>Fri, 07 Aug 2026 10:57:56 +0000</pubDate>
      <link>https://dev.to/salmanshahriar/i-built-an-opensource-production-ready-nextjs-starter-kit-4j37</link>
      <guid>https://dev.to/salmanshahriar/i-built-an-opensource-production-ready-nextjs-starter-kit-4j37</guid>
      <description>&lt;p&gt;Every time I started a new Next.js project, I lost the first week to setup.&lt;/p&gt;

&lt;p&gt;Authentication. Internationalization. Role-based access. SEO meta tags. Environment validation. Error monitoring. Linting. Testing. CI pipelines.&lt;/p&gt;

&lt;p&gt;By the time I had a working foundation, the excitement was gone, buried under configuration files and boilerplate glue code.&lt;/p&gt;

&lt;p&gt;I kept rebuilding the same foundation across SaaS projects, so I stopped and built it once: &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;Next Elite&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It is a frontend-first Next.js 16 + React 19 boilerplate designed to consume APIs (REST/GraphQL/BFF) instead of owning a database, allowing you to drop it on top of any backend you already have. It is feature-based, optimized for speed, SEO, and developer productivity, and includes &lt;strong&gt;40+ custom and reusable UI components&lt;/strong&gt; built on shadcn/ui. It is 100% open source under the MIT license.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://next-elite-boilerplate.vercel.app/" rel="noopener noreferrer"&gt;Live Demo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite/generate" rel="noopener noreferrer"&gt;Use This Template&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://vercel.com/new/clone?repository-url=https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;Deploy on Vercel&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9ccdc9cf650sv06i200.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9ccdc9cf650sv06i200.png" alt="Next.js Elite production-ready SaaS boilerplate cover" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; &lt;code&gt;git clone&lt;/code&gt;, &lt;code&gt;npm install&lt;/code&gt;, &lt;code&gt;cp .env.example .env&lt;/code&gt;, &lt;code&gt;npm run dev&lt;/code&gt;. Open &lt;a href="http://localhost:6767" rel="noopener noreferrer"&gt;http://localhost:6767&lt;/a&gt;. You get auth, RBAC dashboards, 6-language i18n, 40+ UI components, SEO, forms, testing, and CI. &lt;a href="https://next-elite-boilerplate.vercel.app/" rel="noopener noreferrer"&gt;Try the demo&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Why Another Next.js Boilerplate? (The Concept)&lt;/li&gt;
&lt;li&gt;What's Inside: The Next Elite Stack &amp;amp; Features&lt;/li&gt;
&lt;li&gt;Lighthouse Score: 100% Performance &amp;amp; SEO&lt;/li&gt;
&lt;li&gt;Quick Start: Launch Your Project in 60 Seconds&lt;/li&gt;
&lt;li&gt;Deep Dive: How Next Elite Works Under the Hood&lt;/li&gt;
&lt;li&gt;Clean Feature-Based Directory Structure&lt;/li&gt;
&lt;li&gt;Configuration &amp;amp; Environment Variables&lt;/li&gt;
&lt;li&gt;Development, Testing &amp;amp; CI/CD&lt;/li&gt;
&lt;li&gt;Architectural Caveats: What Next Elite is NOT&lt;/li&gt;
&lt;li&gt;Production Checklist: Going Live&lt;/li&gt;
&lt;li&gt;Contributing &amp;amp; Open Source&lt;/li&gt;
&lt;/ol&gt;




&lt;h2 id="why-another-nextjs-boilerplate"&gt;1. Why Another Next.js Boilerplate? (The Concept)&lt;/h2&gt;

&lt;p&gt;Most Next.js starters on GitHub are either too bare (providing just a dark mode toggle and a "TODO: add auth" comment) or too bloated (bundling Prisma, PostgreSQL, Docker Compose, stripe webhooks, and an ORM tightly coupled to their own DB schema).&lt;/p&gt;

&lt;p&gt;If you already have a backend (written in Go, Python, Laravel, or Node.js) or want to build a backend-for-frontend (BFF) architecture, tearing out the built-in database layer from a boilerplate is painful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next Elite sits in the sweet spot.&lt;/strong&gt; It handles the complex frontend foundation, UI components, role management, and locale settings while leaving the database and API fetching structure flexible. It's built to consume APIs directly, allowing you to drop it on top of any backend you already have.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to use Next Elite
&lt;/h3&gt;

&lt;p&gt;Next Elite is best for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SaaS apps with multiple user roles.&lt;/li&gt;
&lt;li&gt;Multi-lingual/Internationalized products (LTR + RTL).&lt;/li&gt;
&lt;li&gt;Frontends consuming an existing backend or BFF.&lt;/li&gt;
&lt;li&gt;Projects requiring a clean, feature-based modular structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is probably overkill for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single-page landing sites.&lt;/li&gt;
&lt;li&gt;Apps that need a tightly-coupled DB layer (API-only design).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2 id="whats-inside"&gt;2. What's Inside: The Next Elite Stack &amp;amp; Features&lt;/h2&gt;

&lt;p&gt;Here is the clean, high-performance tech stack built into Next Elite, broken down by core categories:&lt;/p&gt;

&lt;h3&gt;
  
  
  Frameworks &amp;amp; Core
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Next.js 16 (App Router)&lt;/strong&gt; - Fast, modern React framework with full support for React 19 features (Server/Client components, Server Actions).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;TypeScript 6&lt;/strong&gt; - End-to-end type safety for rock-solid refactoring and developer experience.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Node.js 22&lt;/strong&gt; - Built on the latest LTS runtime (22.12+ required).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Feature-Based Architecture&lt;/strong&gt; - Structured around self-contained vertical slices/feature folders under &lt;code&gt;src/features/&lt;/code&gt; for maximum modularity and clean separation of concerns.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Authentication &amp;amp; Access Control
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;BetterAuth&lt;/strong&gt; - Out-of-the-box email/password and OAuth (Google) authentication using &lt;code&gt;/api/auth/*&lt;/code&gt; route handlers. Configure admin emails via &lt;code&gt;AUTH_ADMIN_EMAILS&lt;/code&gt; or &lt;code&gt;NEXT_PUBLIC_AUTH_ADMIN_EMAILS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Role-Based Access Control (RBAC)&lt;/strong&gt; - Flexible RBAC (&lt;code&gt;user&lt;/code&gt; and &lt;code&gt;admin&lt;/code&gt; roles) with server-side guards (&lt;code&gt;requireUser&lt;/code&gt;, &lt;code&gt;requirePermission&lt;/code&gt;) and parallel route slots (&lt;code&gt;@admin&lt;/code&gt;, &lt;code&gt;@user&lt;/code&gt;) for role-agnostic routing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Internationalization (i18n)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;next-intl&lt;/strong&gt; - Type-safe, cookie-based localizations (no URL prefix) with support for English, বাংলা, العربية (RTL), Français, Español, and 简体中文. Translation keys are type-checked (&lt;code&gt;t("key")&lt;/code&gt; works; typos fail compile-time).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  UI &amp;amp; Styling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Tailwind CSS 4&lt;/strong&gt; - Utility-first styling with &lt;code&gt;@tailwindcss/postcss&lt;/code&gt; and &lt;code&gt;tw-animate-css&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;shadcn/ui&lt;/strong&gt; - Highly customizable UI components built with Tailwind CSS, Radix UI, and CVA. Includes a live &lt;code&gt;/ui-components&lt;/code&gt; showcase page.&lt;/p&gt;


  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnext-elite-boilerplate.vercel.app%2FNextjs-Elite-UI-Image.webp" alt="Next Elite UI Components" width="800" height="600"&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Theme Support&lt;/strong&gt; - Easy light/dark mode transitions via theme toggle.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  API &amp;amp; Data Fetching
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;TanStack Query (React Query)&lt;/strong&gt; - Pre-configured &lt;code&gt;QueryClientProvider&lt;/code&gt; in &lt;code&gt;src/app/providers.tsx&lt;/code&gt; with sensible defaults (&lt;code&gt;staleTime&lt;/code&gt;, &lt;code&gt;gcTime&lt;/code&gt;, retry). Ready to wire &lt;code&gt;useQuery&lt;/code&gt; / &lt;code&gt;useMutation&lt;/code&gt; hooks to your REST, GraphQL, or BFF endpoints.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Observability &amp;amp; Infrastructure
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Sentry Integration&lt;/strong&gt; - Complete error tracking and performance instrumentation for client and server.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Health Probes&lt;/strong&gt; - Direct &lt;code&gt;GET /api/health&lt;/code&gt; endpoint for load balancers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quality Gates &amp;amp; Tooling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Testing Suite&lt;/strong&gt; - Unit/component testing with Vitest and React Testing Library, and E2E testing with Playwright.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Hygiene &amp;amp; Linting&lt;/strong&gt; - &lt;a href="https://oxc.rs/docs/guide/usage/linter" rel="noopener noreferrer"&gt;Oxlint&lt;/a&gt; and &lt;a href="https://oxc.rs/docs/guide/usage/formatter" rel="noopener noreferrer"&gt;Oxfmt&lt;/a&gt; for fast linting and formatting, plus Knip for dead code/dependency hygiene.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Git Hook Automation&lt;/strong&gt; - Lefthook pre-commit hooks (oxlint + oxfmt) and Commitlint to maintain codebase quality.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2 id="lighthouse-score"&gt;3. Lighthouse Score: 100% Performance &amp;amp; SEO&lt;/h2&gt;

&lt;p&gt;One of the key goals of Next Elite was achieving flawless performance and SEO defaults. Out-of-the-box, the production build scores a perfect &lt;strong&gt;100&lt;/strong&gt; across the board on Lighthouse:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lkfe6bd7g51y5rmwbnz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lkfe6bd7g51y5rmwbnz.png" alt="Next Elite Lighthouse Report - 100 Performance, Accessibility, Best Practices, and SEO" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is achieved by rendering Server Components by default, minimizing client-side javascript, optimizing images, and dynamically serving optimized SEO meta tags from a single configuration file.&lt;/p&gt;




&lt;h2 id="quick-start"&gt;4. Quick Start: Launch Your Project in 60 Seconds&lt;/h2&gt;

&lt;h3&gt;
  
  
  One-click Deploy
&lt;/h3&gt;

&lt;p&gt;Deploy this template to Vercel with one click:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://vercel.com/new/clone?repository-url=https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fvercel.com%2Fbutton" alt="Deploy with Vercel" width="103" height="32"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the environment variables from &lt;code&gt;.env.example&lt;/code&gt; in your Vercel project (Production + Preview).&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Node.js &lt;strong&gt;22.12&lt;/strong&gt; or later&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;npm&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Local Setup
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repository and navigate into it:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git clone https://github.com/salmanshahriar/Next-Elite.git
   &lt;span class="nb"&gt;cd &lt;/span&gt;Next-Elite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install dependencies:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Set up your environment variables:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the development server:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;a href="http://localhost:6767" rel="noopener noreferrer"&gt;http://localhost:6767&lt;/a&gt; to view your local instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo Credentials
&lt;/h3&gt;

&lt;p&gt;When &lt;code&gt;NEXT_PUBLIC_DEMO_MODE=true&lt;/code&gt; is enabled, the login screen includes a quick-fill panel with these seed credentials:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;Email&lt;/th&gt;
&lt;th&gt;Password&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;user@test.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;12345678&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Admin&lt;/td&gt;
&lt;td&gt;&lt;code&gt;admin@test.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;12345678&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;[!NOTE]&lt;br&gt;
For production deployments, set &lt;code&gt;NEXT_PUBLIC_DEMO_MODE=false&lt;/code&gt; or remove the self-contained &lt;code&gt;src/features/auth/demo/&lt;/code&gt; module.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Docker Setup
&lt;/h3&gt;

&lt;p&gt;Run the application locally via Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env
docker build &lt;span class="nt"&gt;-t&lt;/span&gt; next-elite &lt;span class="nb"&gt;.&lt;/span&gt;
docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;--env-file&lt;/span&gt; .env &lt;span class="nt"&gt;-p&lt;/span&gt; 6767:6767 next-elite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or using Docker Compose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Dockerfile uses Next.js &lt;strong&gt;standalone&lt;/strong&gt; output with a built-in health check against &lt;code&gt;/api/health&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multi-Arch Deploy (ARM64 + AMD64)
&lt;/h3&gt;

&lt;p&gt;The Dockerfile produces images that run on both &lt;code&gt;linux/amd64&lt;/code&gt; and &lt;code&gt;linux/arm64&lt;/code&gt;. Build a multi-arch image with Buildx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker buildx create &lt;span class="nt"&gt;--name&lt;/span&gt; multiarch &lt;span class="nt"&gt;--use&lt;/span&gt;   &lt;span class="c"&gt;# one-time setup&lt;/span&gt;
docker buildx build &lt;span class="nt"&gt;--platform&lt;/span&gt; linux/amd64,linux/arm64 &lt;span class="nt"&gt;-t&lt;/span&gt; next-elite &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is ideal for self-hosting on ARM servers (Oracle Cloud, Raspberry Pi, etc.).&lt;/p&gt;

&lt;h3&gt;
  
  
  Dokploy Deployment
&lt;/h3&gt;

&lt;p&gt;This template is ready for &lt;a href="https://dokploy.com" rel="noopener noreferrer"&gt;Dokploy&lt;/a&gt; - the open-source PaaS.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new &lt;strong&gt;Application&lt;/strong&gt; in Dokploy and point it to your fork of this repo.&lt;/li&gt;
&lt;li&gt;Set the build type to &lt;strong&gt;Dockerfile&lt;/strong&gt; (auto-detected).&lt;/li&gt;
&lt;li&gt;Configure environment variables via the Dokploy UI (see &lt;code&gt;.env.example&lt;/code&gt; for the full list).&lt;/li&gt;
&lt;li&gt;Deploy - Dokploy automatically builds and runs the container with health checks.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The included &lt;code&gt;HEALTHCHECK&lt;/code&gt; instruction pings &lt;code&gt;/api/health&lt;/code&gt; so Dokploy can monitor and restart the container if it becomes unresponsive.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;View Available Scripts &amp;amp; CLI Commands&lt;/b&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run dev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start the dev server (port 6767)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run build&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Production build&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start the production server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run analyze&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Build with &lt;code&gt;@next/bundle-analyzer&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run check&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;CI gate: typecheck + lint + knip + tests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run lint:fix&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auto-fix with Oxlint + Oxfmt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run test:watch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Vitest watch mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run playwright:install&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Download Playwright browsers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run playwright:install:deps&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Install OS libs for browsers (Linux)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run e2e&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Playwright E2E&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run e2e:ui&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Playwright UI mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run e2e:webkit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Playwright WebKit only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2 id="deep-dive"&gt;5. Deep Dive: How Next Elite Works Under the Hood&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How a request flows:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;User opens a page&lt;/strong&gt; - the Server Component renders first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auth + role check&lt;/strong&gt; - &lt;code&gt;requireUser()&lt;/code&gt; / &lt;code&gt;requirePermission()&lt;/code&gt; read the BetterAuth session and redirect to &lt;code&gt;/login&lt;/code&gt; or &lt;code&gt;/unauthorized&lt;/code&gt; if needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTML is sent&lt;/strong&gt; to the browser; translations come from &lt;code&gt;messages/&lt;/code&gt; via &lt;code&gt;next-intl&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live data&lt;/strong&gt; (lists, forms, etc.) is fetched on the client with TanStack Query → your API (REST/GraphQL/BFF).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Type-Safe RBAC &amp;amp; BetterAuth
&lt;/h3&gt;

&lt;p&gt;Permissions are checked on the server, not with scattered &lt;code&gt;if (role === 'admin')&lt;/code&gt; checks.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;View Auth &amp;amp; RBAC Usage&lt;/b&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Server Component example&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;requirePermission&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/features/auth/rbac/require&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getTranslations&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next-intl/server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;AdminDashboardPage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[,&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="nf"&gt;requirePermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dashboard.view:admin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nf"&gt;getTranslations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dashboard.admin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;AdminDashboardPage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Next Elite utilizes Next.js &lt;strong&gt;Parallel Routes&lt;/strong&gt; to clean up role-agnostic layouts. The routing structure mounts specific slots based on the user's role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/app/(protected)/
  ├── @admin/dashboard/     # Admin dashboard slot
  ├── @user/dashboard/      # User dashboard slot
  └── layout.tsx            # Picks slot based on permissions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;Adding a Role&lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Append the role to the &lt;code&gt;UserRole&lt;/code&gt; union in &lt;code&gt;src/features/auth/rbac/permissions.ts&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Map permissions for the role in &lt;code&gt;src/features/auth/rbac/roles.ts&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Optional: add a parallel route slot - &lt;code&gt;src/app/(protected)/@/...&lt;/code&gt; - and update &lt;code&gt;(protected)/layout.tsx&lt;/code&gt; to render it based on permissions.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Zero-Prefix cookie-based i18n
&lt;/h3&gt;

&lt;p&gt;Unlike standard i18n configurations that force prefixes like &lt;code&gt;/en/&lt;/code&gt; or &lt;code&gt;/es/&lt;/code&gt; in the URL (which can clutter routes and create duplicate routing configurations), Next Elite implements zero-prefix cookie-based locales.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Adding a Language&lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the locale code to &lt;code&gt;languages.supported&lt;/code&gt; in &lt;code&gt;site.config.json&lt;/code&gt; and add an entry under &lt;code&gt;languages.locales&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;messages/.json&lt;/code&gt; mirroring &lt;code&gt;messages/en.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;next-intl&lt;/code&gt; runtime picks it up automatically; types update from &lt;code&gt;src/global.d.ts&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Site &amp;amp; SEO Configuration
&lt;/h3&gt;

&lt;p&gt;&lt;a href="//src/features/site/site.config.json"&gt;&lt;code&gt;src/features/site/site.config.json&lt;/code&gt;&lt;/a&gt; is the single source of truth for SEO metadata, dynamic sitemaps, localized routes, and PWA manifest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"appName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Next Elite"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"domain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://yourdomain.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tagline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Frontend-first, API-driven, batteries included."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Next Elite - Production-Ready SaaS Boilerplate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Frontend-first Next.js 16 + React 19 boilerplate with i18n, RBAC and BetterAuth."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;View Forms Usage (React Hook Form + Zod)&lt;/b&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;zodResolver&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@hookform/resolvers/zod&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useForm&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-hook-form&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;loginSchema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;LoginInput&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/features/auth/schemas/login&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useForm&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;resolver&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;zodResolver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loginSchema&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;defaultValues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2 id="project-structure"&gt;6. Clean Feature-Based Directory Structure&lt;/h2&gt;

&lt;p&gt;Next Elite uses a &lt;strong&gt;Feature-Based (Vertical Slice) Architecture&lt;/strong&gt; under &lt;code&gt;src/features/&lt;/code&gt;. Each folder contains its own components, hooks, schemas, and config. Shared utilities live under &lt;code&gt;src/libs/&lt;/code&gt; or &lt;code&gt;src/components/shared/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;View Directory Structure&lt;/b&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── .github/
│   ├── workflows/            CI: check.yml + playwright.yml
│   └── renovate.json         Dependency updates
├── config/                   vitest.config.ts, vitest.setup.ts
├── e2e/                      Playwright specs + playwright.config.ts
├── messages/                 next-intl translations (en, bn, ar, fr, es, zh)
├── public/                   Static assets
├── tests/                    Vitest specs (auth, i18n)
├── components.json           shadcn/ui CLI config
├── .oxlintrc.json            Oxlint rules (Next.js, TypeScript, React, Unicorn)
├── .oxfmtrc.json             Oxfmt formatter config (Tailwind class sorting)
├── knip.json
├── next.config.mjs
├── package.json              scripts + Commitlint config
├── package-lock.json         npm lockfile (single source of truth)
├── proxy.ts                  Next.js 16 network proxy (pass-through)
├── tsconfig.json
├── lefthook.yml              Git hooks (pre-commit, commit-msg)
├── src/
│   ├── app/                  App Router
│   │   ├── (auth)/           Login &amp;amp;amp; auth pages
│   │   ├── (public)/         Marketing pages (home, ui-components)
│   │   ├── (protected)/      Authenticated area + RBAC
│   │   │   ├── @admin/       Admin dashboard slot
│   │   │   ├── @user/        User dashboard slot
│   │   │   └── layout.tsx    Picks slot based on permissions
│   │   ├── api/              Route handlers (BetterAuth, health)
│   │   ├── layout.tsx        Root layout, SEO, providers
│   │   ├── providers.tsx     Theme + Auth + TanStack Query
│   │   ├── manifest.ts       Web app manifest
│   │   ├── robots.ts         robots.txt
│   │   └── sitemap.ts        Dynamic sitemap
│   ├── components/
│   │   ├── shared/           App-level shared components
│   │   ├── icons/            Icon components
│   │   └── ui/               shadcn/ui primitives
│   ├── features/             Feature modules (vertical slices)
│   │   ├── auth/             BetterAuth + RBAC
│   │   │   ├── lib/          auth + auth-client (BetterAuth singletons)
│   │   │   ├── server/       Server-only helpers (getCurrentUser)
│   │   │   ├── hooks/        Auth provider + useAuth hook
│   │   │   ├── components/   Login form, register form
│   │   │   ├── demo/         Self-contained demo module (delete for prod)
│   │   │   ├── rbac/         permissions, roles, can, require
│   │   │   └── schemas/      Zod login + register schemas
│   │   ├── i18n/             next-intl config (routing, request, actions)
│   │   ├── navigation/       Header, sidebar, topbar, top loader
│   │   ├── site/             siteConfig + locale utilities
│   │   └── theme/            Theme provider + toggle
│   ├── hooks/                Cross-feature hooks (use-scroll)
│   ├── libs/                 Cross-cutting infra (env, query-client, utils)
│   ├── instrumentation.ts    Server Sentry init
│   ├── instrumentation-client.ts  Client Sentry init
│   └── global.d.ts           next-intl type augmentation
└── ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2 id="configuration"&gt;7. Configuration &amp;amp; Environment Variables&lt;/h2&gt;

&lt;p&gt;Every variable is documented in &lt;a href="//.env.example"&gt;&lt;code&gt;.env.example&lt;/code&gt;&lt;/a&gt; and validated by &lt;code&gt;src/libs/env.ts&lt;/code&gt; (T3 Env).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;BETTER_AUTH_URL&lt;/code&gt; is optional - derived from &lt;code&gt;VERCEL_URL&lt;/code&gt; in production, &lt;code&gt;http://localhost:6767&lt;/code&gt; locally.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;BETTER_AUTH_SECRET&lt;/code&gt; (32+ chars) must be set at runtime in production. A missing secret logs a warning instead of crashing the build.&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;SKIP_ENV_VALIDATION=true&lt;/code&gt; in CI / Docker build steps when env vars aren't available yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Key variables:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variable&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;BETTER_AUTH_SECRET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auth signing secret (32+ chars)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GOOGLE_CLIENT_ID/SECRET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Optional Google OAuth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NEXT_PUBLIC_GOOGLE_AUTH_ENABLED&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show Google sign-in button&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AUTH_ADMIN_EMAILS&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Comma-separated admin role emails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NEXT_PUBLIC_DEMO_MODE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Demo credentials panel (disable for prod)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;SENTRY_DSN&lt;/code&gt; / &lt;code&gt;NEXT_PUBLIC_SENTRY_DSN&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Optional Sentry error tracking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NEXT_PUBLIC_APP_URL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Public app URL (SEO/OAuth)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2 id="development-testing"&gt;8. Development, Testing &amp;amp; CI/CD&lt;/h2&gt;

&lt;h3&gt;
  
  
  Editor Setup
&lt;/h3&gt;

&lt;p&gt;Install the &lt;a href="https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode" rel="noopener noreferrer"&gt;Oxc VS Code extension&lt;/a&gt; (&lt;code&gt;oxc.oxc-vscode&lt;/code&gt;) for format-on-save and Oxlint fix-on-save. Project settings in &lt;code&gt;.vscode/settings.json&lt;/code&gt; are preconfigured.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unit / component:&lt;/strong&gt; Vitest + React Testing Library (&lt;code&gt;config/vitest.config.ts&lt;/code&gt;). Use &lt;code&gt;renderWithProviders&lt;/code&gt; from &lt;code&gt;@tests/utils/render&lt;/code&gt; for components that need app context (i18n, theme, auth, React Query). Plain &lt;code&gt;render&lt;/code&gt; is fine for isolated UI primitives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;End-to-end:&lt;/strong&gt; Playwright in &lt;code&gt;e2e/&lt;/code&gt; on port &lt;strong&gt;6767&lt;/strong&gt; (&lt;code&gt;127.0.0.1&lt;/code&gt;). Local runs use &lt;code&gt;next dev&lt;/code&gt; (all browsers); CI uses production &lt;code&gt;next start&lt;/code&gt; (Chromium only). Run &lt;code&gt;playwright:install&lt;/code&gt; before the first E2E run; on Linux, WebKit needs &lt;code&gt;playwright:install:deps&lt;/code&gt; (sudo). Stop &lt;code&gt;npm run dev&lt;/code&gt; before &lt;code&gt;npm run e2e&lt;/code&gt; - E2E starts its own server.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  CI/CD Pipeline
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.github/workflows/check.yml&lt;/code&gt; - typecheck → lint → knip → unit tests → build, on every push and PR.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.github/workflows/playwright.yml&lt;/code&gt; - build → Playwright E2E (Chromium, production server).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.github/renovate.json&lt;/code&gt; - groups non-major dependency updates and automerges patches.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2 id="architectural-caveats"&gt;9. Architectural Caveats: What Next Elite is NOT&lt;/h2&gt;

&lt;p&gt;To keep the boilerplate clean and adaptable, I made specific design trade-offs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;No Database Bundled:&lt;/strong&gt; There is no Prisma, Drizzle, Postgres, or MongoDB setup. Next Elite is built to communicate with an external API. BetterAuth runs without a database adapter out of the box.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple RBAC System:&lt;/strong&gt; The starter RBAC covers two roles (&lt;code&gt;user&lt;/code&gt; and &lt;code&gt;admin&lt;/code&gt;) with a fast-path admin list via environment variables. For complex multi-tenant permissions, map roles on your main database and API layer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cookie-Based i18n:&lt;/strong&gt; By storing user localization choice in a cookie rather than a path-prefix (like &lt;code&gt;/en/dashboard&lt;/code&gt;), routes remain simpler, but path-prefixed SEO indexing for multiple locales will require a custom router setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local BetterAuth Sessions:&lt;/strong&gt; By default, session keys run locally. A session adapter is recommended for production setups using multiple server instances.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2 id="production-checklist"&gt;10. Production Checklist: Going Live&lt;/h2&gt;

&lt;p&gt;Before deploying Next Elite to production, run through these essential configuration steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure Auth Secrets:&lt;/strong&gt; Set &lt;code&gt;BETTER_AUTH_SECRET&lt;/code&gt; (at least 32 characters long) in your hosting dashboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add a Session Storage Adapter:&lt;/strong&gt; BetterAuth requires an external database or Redis adapter to manage server sessions in multi-instance production environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Disable Demo Mode:&lt;/strong&gt; Set &lt;code&gt;NEXT_PUBLIC_DEMO_MODE=false&lt;/code&gt; or completely delete the &lt;code&gt;src/features/auth/demo/&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link Your API:&lt;/strong&gt; Point &lt;code&gt;NEXT_PUBLIC_APP_URL&lt;/code&gt; at your live domain and wire TanStack Query hooks to your REST/GraphQL/BFF service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update SEO Metadata:&lt;/strong&gt; Change &lt;code&gt;src/features/site/site.config.json&lt;/code&gt; with your project domain, official OG image, and app description.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enable Error Tracking:&lt;/strong&gt; Set &lt;code&gt;SENTRY_DSN&lt;/code&gt; and &lt;code&gt;NEXT_PUBLIC_SENTRY_DSN&lt;/code&gt; to activate Sentry instrumentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set &lt;code&gt;SKIP_ENV_VALIDATION=true&lt;/code&gt;&lt;/strong&gt; in CI/Docker build steps when env vars aren't available at build time.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2 id="contributing"&gt;11. Contributing &amp;amp; Open Source&lt;/h2&gt;

&lt;p&gt;Next Elite is free and open-source under the &lt;strong&gt;MIT license&lt;/strong&gt;. Contributions, bug reports, and discussions are welcome!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fork &amp;amp; branch from &lt;code&gt;main&lt;/code&gt; (&lt;code&gt;feat/...&lt;/code&gt;, &lt;code&gt;fix/...&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;Ensure &lt;code&gt;npm run check&lt;/code&gt; passes locally.&lt;/li&gt;
&lt;li&gt;Use Conventional Commits.&lt;/li&gt;
&lt;li&gt;Open a pull request.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  If this boilerplate saved you time, a star helps more devs discover it
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://next-elite-boilerplate.vercel.app/" rel="noopener noreferrer"&gt;Live Demo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite/generate" rel="noopener noreferrer"&gt;Use Template&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://vercel.com/new/clone?repository-url=https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;Deploy on Vercel&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>boilerplate</category>
      <category>betterauth</category>
    </item>
    <item>
      <title>I built an opensource production-ready NEXT.JS STARTER KIT!</title>
      <dc:creator>Salman Shahriar</dc:creator>
      <pubDate>Wed, 19 Nov 2025 19:11:28 +0000</pubDate>
      <link>https://dev.to/salmanshahriar/i-built-a-production-ready-nextjs-boilerplate-so-you-dont-have-to-17d3</link>
      <guid>https://dev.to/salmanshahriar/i-built-a-production-ready-nextjs-boilerplate-so-you-dont-have-to-17d3</guid>
      <description>&lt;p&gt;Every time I started a new Next.js project, I lost the first week to setup.&lt;/p&gt;

&lt;p&gt;Authentication. Internationalization. Role-based access. SEO meta tags. Environment validation. Error monitoring. Linting. Testing. CI pipelines.&lt;/p&gt;

&lt;p&gt;By the time I had a working foundation, the excitement was gone, buried under configuration files and boilerplate glue code.&lt;/p&gt;

&lt;p&gt;I kept rebuilding the same foundation across SaaS projects, so I stopped and built it once: &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;Next Elite&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It is a frontend-first Next.js 16 + React 19 boilerplate designed to consume APIs (REST/GraphQL/BFF) instead of owning a database, allowing you to drop it on top of any backend you already have. It is feature-based, optimized for speed, SEO, and developer productivity, and includes &lt;strong&gt;40+ custom and reusable UI components&lt;/strong&gt; built on shadcn/ui. It is 100% open source under the MIT license.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://next-elite-boilerplate.vercel.app/" rel="noopener noreferrer"&gt;Live Demo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite/generate" rel="noopener noreferrer"&gt;Use This Template&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://vercel.com/new/clone?repository-url=https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;Deploy on Vercel&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9ccdc9cf650sv06i200.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9ccdc9cf650sv06i200.png" alt="Next.js Elite production-ready SaaS boilerplate cover" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; &lt;code&gt;git clone&lt;/code&gt;, &lt;code&gt;npm install&lt;/code&gt;, &lt;code&gt;cp .env.example .env&lt;/code&gt;, &lt;code&gt;npm run dev&lt;/code&gt;. Open &lt;a href="http://localhost:6767" rel="noopener noreferrer"&gt;http://localhost:6767&lt;/a&gt;. You get auth, RBAC dashboards, 6-language i18n, 40+ UI components, SEO, forms, testing, and CI. &lt;a href="https://next-elite-boilerplate.vercel.app/" rel="noopener noreferrer"&gt;Try the demo&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Why Another Next.js Boilerplate? (The Concept)&lt;/li&gt;
&lt;li&gt;What's Inside: The Next Elite Stack &amp;amp; Features&lt;/li&gt;
&lt;li&gt;Lighthouse Score: 100% Performance &amp;amp; SEO&lt;/li&gt;
&lt;li&gt;Quick Start: Launch Your Project in 60 Seconds&lt;/li&gt;
&lt;li&gt;Deep Dive: How Next Elite Works Under the Hood&lt;/li&gt;
&lt;li&gt;Clean Feature-Based Directory Structure&lt;/li&gt;
&lt;li&gt;Configuration &amp;amp; Environment Variables&lt;/li&gt;
&lt;li&gt;Development, Testing &amp;amp; CI/CD&lt;/li&gt;
&lt;li&gt;Architectural Caveats: What Next Elite is NOT&lt;/li&gt;
&lt;li&gt;Production Checklist: Going Live&lt;/li&gt;
&lt;li&gt;Contributing &amp;amp; Open Source&lt;/li&gt;
&lt;/ol&gt;




&lt;h2 id="why-another-nextjs-boilerplate"&gt;1. Why Another Next.js Boilerplate? (The Concept)&lt;/h2&gt;

&lt;p&gt;Most Next.js starters on GitHub are either too bare (providing just a dark mode toggle and a "TODO: add auth" comment) or too bloated (bundling Prisma, PostgreSQL, Docker Compose, stripe webhooks, and an ORM tightly coupled to their own DB schema).&lt;/p&gt;

&lt;p&gt;If you already have a backend (written in Go, Python, Laravel, or Node.js) or want to build a backend-for-frontend (BFF) architecture, tearing out the built-in database layer from a boilerplate is painful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next Elite sits in the sweet spot.&lt;/strong&gt; It handles the complex frontend foundation, UI components, role management, and locale settings while leaving the database and API fetching structure flexible. It's built to consume APIs directly, allowing you to drop it on top of any backend you already have.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to use Next Elite
&lt;/h3&gt;

&lt;p&gt;Next Elite is best for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SaaS apps with multiple user roles.&lt;/li&gt;
&lt;li&gt;Multi-lingual/Internationalized products (LTR + RTL).&lt;/li&gt;
&lt;li&gt;Frontends consuming an existing backend or BFF.&lt;/li&gt;
&lt;li&gt;Projects requiring a clean, feature-based modular structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is probably overkill for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single-page landing sites.&lt;/li&gt;
&lt;li&gt;Apps that need a tightly-coupled DB layer (API-only design).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2 id="whats-inside"&gt;2. What's Inside: The Next Elite Stack &amp;amp; Features&lt;/h2&gt;

&lt;p&gt;Here is the clean, high-performance tech stack built into Next Elite, broken down by core categories:&lt;/p&gt;

&lt;h3&gt;
  
  
  Frameworks &amp;amp; Core
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Next.js 16 (App Router)&lt;/strong&gt; - Fast, modern React framework with full support for React 19 features (Server/Client components, Server Actions).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;TypeScript 6&lt;/strong&gt; - End-to-end type safety for rock-solid refactoring and developer experience.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Node.js 22&lt;/strong&gt; - Built on the latest LTS runtime (22.12+ required).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Feature-Based Architecture&lt;/strong&gt; - Structured around self-contained vertical slices/feature folders under &lt;code&gt;src/features/&lt;/code&gt; for maximum modularity and clean separation of concerns.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Authentication &amp;amp; Access Control
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;BetterAuth&lt;/strong&gt; - Out-of-the-box email/password and OAuth (Google) authentication using &lt;code&gt;/api/auth/*&lt;/code&gt; route handlers. Configure admin emails via &lt;code&gt;AUTH_ADMIN_EMAILS&lt;/code&gt; or &lt;code&gt;NEXT_PUBLIC_AUTH_ADMIN_EMAILS&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Role-Based Access Control (RBAC)&lt;/strong&gt; - Flexible RBAC (&lt;code&gt;user&lt;/code&gt; and &lt;code&gt;admin&lt;/code&gt; roles) with server-side guards (&lt;code&gt;requireUser&lt;/code&gt;, &lt;code&gt;requirePermission&lt;/code&gt;) and parallel route slots (&lt;code&gt;@admin&lt;/code&gt;, &lt;code&gt;@user&lt;/code&gt;) for role-agnostic routing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Internationalization (i18n)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;next-intl&lt;/strong&gt; - Type-safe, cookie-based localizations (no URL prefix) with support for English, বাংলা, العربية (RTL), Français, Español, and 简体中文. Translation keys are type-checked (&lt;code&gt;t("key")&lt;/code&gt; works; typos fail compile-time).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  UI &amp;amp; Styling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Tailwind CSS 4&lt;/strong&gt; - Utility-first styling with &lt;code&gt;@tailwindcss/postcss&lt;/code&gt; and &lt;code&gt;tw-animate-css&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;shadcn/ui&lt;/strong&gt; - Highly customizable UI components built with Tailwind CSS, Radix UI, and CVA. Includes a live &lt;code&gt;/ui-components&lt;/code&gt; showcase page.&lt;/p&gt;


  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnext-elite-boilerplate.vercel.app%2FNextjs-Elite-UI-Image.webp" alt="Next Elite UI Components" width="800" height="600"&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Theme Support&lt;/strong&gt; - Easy light/dark mode transitions via theme toggle.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  API &amp;amp; Data Fetching
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;TanStack Query (React Query)&lt;/strong&gt; - Pre-configured &lt;code&gt;QueryClientProvider&lt;/code&gt; in &lt;code&gt;src/app/providers.tsx&lt;/code&gt; with sensible defaults (&lt;code&gt;staleTime&lt;/code&gt;, &lt;code&gt;gcTime&lt;/code&gt;, retry). Ready to wire &lt;code&gt;useQuery&lt;/code&gt; / &lt;code&gt;useMutation&lt;/code&gt; hooks to your REST, GraphQL, or BFF endpoints.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Observability &amp;amp; Infrastructure
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Sentry Integration&lt;/strong&gt; - Complete error tracking and performance instrumentation for client and server.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Health Probes&lt;/strong&gt; - Direct &lt;code&gt;GET /api/health&lt;/code&gt; endpoint for load balancers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quality Gates &amp;amp; Tooling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Testing Suite&lt;/strong&gt; - Unit/component testing with Vitest and React Testing Library, and E2E testing with Playwright.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Hygiene &amp;amp; Linting&lt;/strong&gt; - &lt;a href="https://oxc.rs/docs/guide/usage/linter" rel="noopener noreferrer"&gt;Oxlint&lt;/a&gt; and &lt;a href="https://oxc.rs/docs/guide/usage/formatter" rel="noopener noreferrer"&gt;Oxfmt&lt;/a&gt; for fast linting and formatting, plus Knip for dead code/dependency hygiene.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Git Hook Automation&lt;/strong&gt; - Lefthook pre-commit hooks (oxlint + oxfmt) and Commitlint to maintain codebase quality.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2 id="lighthouse-score"&gt;3. Lighthouse Score: 100% Performance &amp;amp; SEO&lt;/h2&gt;

&lt;p&gt;One of the key goals of Next Elite was achieving flawless performance and SEO defaults. Out-of-the-box, the production build scores a perfect &lt;strong&gt;100&lt;/strong&gt; across the board on Lighthouse:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lkfe6bd7g51y5rmwbnz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0lkfe6bd7g51y5rmwbnz.png" alt="Next Elite Lighthouse Report - 100 Performance, Accessibility, Best Practices, and SEO" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is achieved by rendering Server Components by default, minimizing client-side javascript, optimizing images, and dynamically serving optimized SEO meta tags from a single configuration file.&lt;/p&gt;




&lt;h2 id="quick-start"&gt;4. Quick Start: Launch Your Project in 60 Seconds&lt;/h2&gt;

&lt;h3&gt;
  
  
  One-click Deploy
&lt;/h3&gt;

&lt;p&gt;Deploy this template to Vercel with one click:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://vercel.com/new/clone?repository-url=https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fvercel.com%2Fbutton" alt="Deploy with Vercel" width="103" height="32"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the environment variables from &lt;code&gt;.env.example&lt;/code&gt; in your Vercel project (Production + Preview).&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Node.js &lt;strong&gt;22.12&lt;/strong&gt; or later&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;npm&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Local Setup
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repository and navigate into it:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git clone https://github.com/salmanshahriar/Next-Elite.git
   &lt;span class="nb"&gt;cd &lt;/span&gt;Next-Elite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install dependencies:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Set up your environment variables:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the development server:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;a href="http://localhost:6767" rel="noopener noreferrer"&gt;http://localhost:6767&lt;/a&gt; to view your local instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo Credentials
&lt;/h3&gt;

&lt;p&gt;When &lt;code&gt;NEXT_PUBLIC_DEMO_MODE=true&lt;/code&gt; is enabled, the login screen includes a quick-fill panel with these seed credentials:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;Email&lt;/th&gt;
&lt;th&gt;Password&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User&lt;/td&gt;
&lt;td&gt;&lt;code&gt;user@test.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;12345678&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Admin&lt;/td&gt;
&lt;td&gt;&lt;code&gt;admin@test.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;12345678&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;[!NOTE]&lt;br&gt;
For production deployments, set &lt;code&gt;NEXT_PUBLIC_DEMO_MODE=false&lt;/code&gt; or remove the self-contained &lt;code&gt;src/features/auth/demo/&lt;/code&gt; module.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Docker Setup
&lt;/h3&gt;

&lt;p&gt;Run the application locally via Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env
docker build &lt;span class="nt"&gt;-t&lt;/span&gt; next-elite &lt;span class="nb"&gt;.&lt;/span&gt;
docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;--env-file&lt;/span&gt; .env &lt;span class="nt"&gt;-p&lt;/span&gt; 6767:6767 next-elite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or using Docker Compose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Dockerfile uses Next.js &lt;strong&gt;standalone&lt;/strong&gt; output with a built-in health check against &lt;code&gt;/api/health&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multi-Arch Deploy (ARM64 + AMD64)
&lt;/h3&gt;

&lt;p&gt;The Dockerfile produces images that run on both &lt;code&gt;linux/amd64&lt;/code&gt; and &lt;code&gt;linux/arm64&lt;/code&gt;. Build a multi-arch image with Buildx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker buildx create &lt;span class="nt"&gt;--name&lt;/span&gt; multiarch &lt;span class="nt"&gt;--use&lt;/span&gt;   &lt;span class="c"&gt;# one-time setup&lt;/span&gt;
docker buildx build &lt;span class="nt"&gt;--platform&lt;/span&gt; linux/amd64,linux/arm64 &lt;span class="nt"&gt;-t&lt;/span&gt; next-elite &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is ideal for self-hosting on ARM servers (Oracle Cloud, Raspberry Pi, etc.).&lt;/p&gt;

&lt;h3&gt;
  
  
  Dokploy Deployment
&lt;/h3&gt;

&lt;p&gt;This template is ready for &lt;a href="https://dokploy.com" rel="noopener noreferrer"&gt;Dokploy&lt;/a&gt; - the open-source PaaS.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new &lt;strong&gt;Application&lt;/strong&gt; in Dokploy and point it to your fork of this repo.&lt;/li&gt;
&lt;li&gt;Set the build type to &lt;strong&gt;Dockerfile&lt;/strong&gt; (auto-detected).&lt;/li&gt;
&lt;li&gt;Configure environment variables via the Dokploy UI (see &lt;code&gt;.env.example&lt;/code&gt; for the full list).&lt;/li&gt;
&lt;li&gt;Deploy - Dokploy automatically builds and runs the container with health checks.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The included &lt;code&gt;HEALTHCHECK&lt;/code&gt; instruction pings &lt;code&gt;/api/health&lt;/code&gt; so Dokploy can monitor and restart the container if it becomes unresponsive.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;View Available Scripts &amp;amp; CLI Commands&lt;/b&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run dev&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start the dev server (port 6767)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run build&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Production build&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start the production server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run analyze&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Build with &lt;code&gt;@next/bundle-analyzer&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run check&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;CI gate: typecheck + lint + knip + tests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run lint:fix&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auto-fix with Oxlint + Oxfmt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run test:watch&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Vitest watch mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run playwright:install&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Download Playwright browsers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run playwright:install:deps&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Install OS libs for browsers (Linux)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run e2e&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Playwright E2E&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run e2e:ui&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Playwright UI mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;npm run e2e:webkit&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Playwright WebKit only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2 id="deep-dive"&gt;5. Deep Dive: How Next Elite Works Under the Hood&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How a request flows:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;User opens a page&lt;/strong&gt; - the Server Component renders first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auth + role check&lt;/strong&gt; - &lt;code&gt;requireUser()&lt;/code&gt; / &lt;code&gt;requirePermission()&lt;/code&gt; read the BetterAuth session and redirect to &lt;code&gt;/login&lt;/code&gt; or &lt;code&gt;/unauthorized&lt;/code&gt; if needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTML is sent&lt;/strong&gt; to the browser; translations come from &lt;code&gt;messages/&lt;/code&gt; via &lt;code&gt;next-intl&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live data&lt;/strong&gt; (lists, forms, etc.) is fetched on the client with TanStack Query → your API (REST/GraphQL/BFF).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Type-Safe RBAC &amp;amp; BetterAuth
&lt;/h3&gt;

&lt;p&gt;Permissions are checked on the server, not with scattered &lt;code&gt;if (role === 'admin')&lt;/code&gt; checks.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;View Auth &amp;amp; RBAC Usage&lt;/b&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Server Component example&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;requirePermission&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/features/auth/rbac/require&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getTranslations&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next-intl/server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;AdminDashboardPage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;gt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[,&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="nf"&gt;requirePermission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dashboard.view:admin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nf"&gt;getTranslations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dashboard.admin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;]);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;AdminDashboardPage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Next Elite utilizes Next.js &lt;strong&gt;Parallel Routes&lt;/strong&gt; to clean up role-agnostic layouts. The routing structure mounts specific slots based on the user's role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/app/(protected)/
  ├── @admin/dashboard/     # Admin dashboard slot
  ├── @user/dashboard/      # User dashboard slot
  └── layout.tsx            # Picks slot based on permissions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;Adding a Role&lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Append the role to the &lt;code&gt;UserRole&lt;/code&gt; union in &lt;code&gt;src/features/auth/rbac/permissions.ts&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Map permissions for the role in &lt;code&gt;src/features/auth/rbac/roles.ts&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Optional: add a parallel route slot - &lt;code&gt;src/app/(protected)/@/...&lt;/code&gt; - and update &lt;code&gt;(protected)/layout.tsx&lt;/code&gt; to render it based on permissions.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Zero-Prefix cookie-based i18n
&lt;/h3&gt;

&lt;p&gt;Unlike standard i18n configurations that force prefixes like &lt;code&gt;/en/&lt;/code&gt; or &lt;code&gt;/es/&lt;/code&gt; in the URL (which can clutter routes and create duplicate routing configurations), Next Elite implements zero-prefix cookie-based locales.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Adding a Language&lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the locale code to &lt;code&gt;languages.supported&lt;/code&gt; in &lt;code&gt;site.config.json&lt;/code&gt; and add an entry under &lt;code&gt;languages.locales&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;messages/.json&lt;/code&gt; mirroring &lt;code&gt;messages/en.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;next-intl&lt;/code&gt; runtime picks it up automatically; types update from &lt;code&gt;src/global.d.ts&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Site &amp;amp; SEO Configuration
&lt;/h3&gt;

&lt;p&gt;&lt;a href="//src/features/site/site.config.json"&gt;&lt;code&gt;src/features/site/site.config.json&lt;/code&gt;&lt;/a&gt; is the single source of truth for SEO metadata, dynamic sitemaps, localized routes, and PWA manifest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"appName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Next Elite"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"domain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://yourdomain.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tagline"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Frontend-first, API-driven, batteries included."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Next Elite - Production-Ready SaaS Boilerplate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Frontend-first Next.js 16 + React 19 boilerplate with i18n, RBAC and BetterAuth."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;b&gt;View Forms Usage (React Hook Form + Zod)&lt;/b&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;zodResolver&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@hookform/resolvers/zod&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useForm&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-hook-form&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;loginSchema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;LoginInput&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/features/auth/schemas/login&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useForm&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;resolver&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;zodResolver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loginSchema&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;defaultValues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2 id="project-structure"&gt;6. Clean Feature-Based Directory Structure&lt;/h2&gt;

&lt;p&gt;Next Elite uses a &lt;strong&gt;Feature-Based (Vertical Slice) Architecture&lt;/strong&gt; under &lt;code&gt;src/features/&lt;/code&gt;. Each folder contains its own components, hooks, schemas, and config. Shared utilities live under &lt;code&gt;src/libs/&lt;/code&gt; or &lt;code&gt;src/components/shared/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;View Directory Structure&lt;/b&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── .github/
│   ├── workflows/            CI: check.yml + playwright.yml
│   └── renovate.json         Dependency updates
├── config/                   vitest.config.ts, vitest.setup.ts
├── e2e/                      Playwright specs + playwright.config.ts
├── messages/                 next-intl translations (en, bn, ar, fr, es, zh)
├── public/                   Static assets
├── tests/                    Vitest specs (auth, i18n)
├── components.json           shadcn/ui CLI config
├── .oxlintrc.json            Oxlint rules (Next.js, TypeScript, React, Unicorn)
├── .oxfmtrc.json             Oxfmt formatter config (Tailwind class sorting)
├── knip.json
├── next.config.mjs
├── package.json              scripts + Commitlint config
├── package-lock.json         npm lockfile (single source of truth)
├── proxy.ts                  Next.js 16 network proxy (pass-through)
├── tsconfig.json
├── lefthook.yml              Git hooks (pre-commit, commit-msg)
├── src/
│   ├── app/                  App Router
│   │   ├── (auth)/           Login &amp;amp;amp; auth pages
│   │   ├── (public)/         Marketing pages (home, ui-components)
│   │   ├── (protected)/      Authenticated area + RBAC
│   │   │   ├── @admin/       Admin dashboard slot
│   │   │   ├── @user/        User dashboard slot
│   │   │   └── layout.tsx    Picks slot based on permissions
│   │   ├── api/              Route handlers (BetterAuth, health)
│   │   ├── layout.tsx        Root layout, SEO, providers
│   │   ├── providers.tsx     Theme + Auth + TanStack Query
│   │   ├── manifest.ts       Web app manifest
│   │   ├── robots.ts         robots.txt
│   │   └── sitemap.ts        Dynamic sitemap
│   ├── components/
│   │   ├── shared/           App-level shared components
│   │   ├── icons/            Icon components
│   │   └── ui/               shadcn/ui primitives
│   ├── features/             Feature modules (vertical slices)
│   │   ├── auth/             BetterAuth + RBAC
│   │   │   ├── lib/          auth + auth-client (BetterAuth singletons)
│   │   │   ├── server/       Server-only helpers (getCurrentUser)
│   │   │   ├── hooks/        Auth provider + useAuth hook
│   │   │   ├── components/   Login form, register form
│   │   │   ├── demo/         Self-contained demo module (delete for prod)
│   │   │   ├── rbac/         permissions, roles, can, require
│   │   │   └── schemas/      Zod login + register schemas
│   │   ├── i18n/             next-intl config (routing, request, actions)
│   │   ├── navigation/       Header, sidebar, topbar, top loader
│   │   ├── site/             siteConfig + locale utilities
│   │   └── theme/            Theme provider + toggle
│   ├── hooks/                Cross-feature hooks (use-scroll)
│   ├── libs/                 Cross-cutting infra (env, query-client, utils)
│   ├── instrumentation.ts    Server Sentry init
│   ├── instrumentation-client.ts  Client Sentry init
│   └── global.d.ts           next-intl type augmentation
└── ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2 id="configuration"&gt;7. Configuration &amp;amp; Environment Variables&lt;/h2&gt;

&lt;p&gt;Every variable is documented in &lt;a href="//.env.example"&gt;&lt;code&gt;.env.example&lt;/code&gt;&lt;/a&gt; and validated by &lt;code&gt;src/libs/env.ts&lt;/code&gt; (T3 Env).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;BETTER_AUTH_URL&lt;/code&gt; is optional - derived from &lt;code&gt;VERCEL_URL&lt;/code&gt; in production, &lt;code&gt;http://localhost:6767&lt;/code&gt; locally.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;BETTER_AUTH_SECRET&lt;/code&gt; (32+ chars) must be set at runtime in production. A missing secret logs a warning instead of crashing the build.&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;SKIP_ENV_VALIDATION=true&lt;/code&gt; in CI / Docker build steps when env vars aren't available yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Key variables:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variable&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;BETTER_AUTH_SECRET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auth signing secret (32+ chars)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GOOGLE_CLIENT_ID/SECRET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Optional Google OAuth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NEXT_PUBLIC_GOOGLE_AUTH_ENABLED&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show Google sign-in button&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AUTH_ADMIN_EMAILS&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Comma-separated admin role emails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NEXT_PUBLIC_DEMO_MODE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Demo credentials panel (disable for prod)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;SENTRY_DSN&lt;/code&gt; / &lt;code&gt;NEXT_PUBLIC_SENTRY_DSN&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Optional Sentry error tracking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NEXT_PUBLIC_APP_URL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Public app URL (SEO/OAuth)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2 id="development-testing"&gt;8. Development, Testing &amp;amp; CI/CD&lt;/h2&gt;

&lt;h3&gt;
  
  
  Editor Setup
&lt;/h3&gt;

&lt;p&gt;Install the &lt;a href="https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode" rel="noopener noreferrer"&gt;Oxc VS Code extension&lt;/a&gt; (&lt;code&gt;oxc.oxc-vscode&lt;/code&gt;) for format-on-save and Oxlint fix-on-save. Project settings in &lt;code&gt;.vscode/settings.json&lt;/code&gt; are preconfigured.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unit / component:&lt;/strong&gt; Vitest + React Testing Library (&lt;code&gt;config/vitest.config.ts&lt;/code&gt;). Use &lt;code&gt;renderWithProviders&lt;/code&gt; from &lt;code&gt;@tests/utils/render&lt;/code&gt; for components that need app context (i18n, theme, auth, React Query). Plain &lt;code&gt;render&lt;/code&gt; is fine for isolated UI primitives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;End-to-end:&lt;/strong&gt; Playwright in &lt;code&gt;e2e/&lt;/code&gt; on port &lt;strong&gt;6767&lt;/strong&gt; (&lt;code&gt;127.0.0.1&lt;/code&gt;). Local runs use &lt;code&gt;next dev&lt;/code&gt; (all browsers); CI uses production &lt;code&gt;next start&lt;/code&gt; (Chromium only). Run &lt;code&gt;playwright:install&lt;/code&gt; before the first E2E run; on Linux, WebKit needs &lt;code&gt;playwright:install:deps&lt;/code&gt; (sudo). Stop &lt;code&gt;npm run dev&lt;/code&gt; before &lt;code&gt;npm run e2e&lt;/code&gt; - E2E starts its own server.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  CI/CD Pipeline
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.github/workflows/check.yml&lt;/code&gt; - typecheck → lint → knip → unit tests → build, on every push and PR.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.github/workflows/playwright.yml&lt;/code&gt; - build → Playwright E2E (Chromium, production server).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.github/renovate.json&lt;/code&gt; - groups non-major dependency updates and automerges patches.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2 id="architectural-caveats"&gt;9. Architectural Caveats: What Next Elite is NOT&lt;/h2&gt;

&lt;p&gt;To keep the boilerplate clean and adaptable, I made specific design trade-offs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;No Database Bundled:&lt;/strong&gt; There is no Prisma, Drizzle, Postgres, or MongoDB setup. Next Elite is built to communicate with an external API. BetterAuth runs without a database adapter out of the box.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple RBAC System:&lt;/strong&gt; The starter RBAC covers two roles (&lt;code&gt;user&lt;/code&gt; and &lt;code&gt;admin&lt;/code&gt;) with a fast-path admin list via environment variables. For complex multi-tenant permissions, map roles on your main database and API layer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cookie-Based i18n:&lt;/strong&gt; By storing user localization choice in a cookie rather than a path-prefix (like &lt;code&gt;/en/dashboard&lt;/code&gt;), routes remain simpler, but path-prefixed SEO indexing for multiple locales will require a custom router setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local BetterAuth Sessions:&lt;/strong&gt; By default, session keys run locally. A session adapter is recommended for production setups using multiple server instances.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2 id="production-checklist"&gt;10. Production Checklist: Going Live&lt;/h2&gt;

&lt;p&gt;Before deploying Next Elite to production, run through these essential configuration steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure Auth Secrets:&lt;/strong&gt; Set &lt;code&gt;BETTER_AUTH_SECRET&lt;/code&gt; (at least 32 characters long) in your hosting dashboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add a Session Storage Adapter:&lt;/strong&gt; BetterAuth requires an external database or Redis adapter to manage server sessions in multi-instance production environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Disable Demo Mode:&lt;/strong&gt; Set &lt;code&gt;NEXT_PUBLIC_DEMO_MODE=false&lt;/code&gt; or completely delete the &lt;code&gt;src/features/auth/demo/&lt;/code&gt; folder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link Your API:&lt;/strong&gt; Point &lt;code&gt;NEXT_PUBLIC_APP_URL&lt;/code&gt; at your live domain and wire TanStack Query hooks to your REST/GraphQL/BFF service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update SEO Metadata:&lt;/strong&gt; Change &lt;code&gt;src/features/site/site.config.json&lt;/code&gt; with your project domain, official OG image, and app description.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enable Error Tracking:&lt;/strong&gt; Set &lt;code&gt;SENTRY_DSN&lt;/code&gt; and &lt;code&gt;NEXT_PUBLIC_SENTRY_DSN&lt;/code&gt; to activate Sentry instrumentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set &lt;code&gt;SKIP_ENV_VALIDATION=true&lt;/code&gt;&lt;/strong&gt; in CI/Docker build steps when env vars aren't available at build time.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2 id="contributing"&gt;11. Contributing &amp;amp; Open Source&lt;/h2&gt;

&lt;p&gt;Next Elite is free and open-source under the &lt;strong&gt;MIT license&lt;/strong&gt;. Contributions, bug reports, and discussions are welcome!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fork &amp;amp; branch from &lt;code&gt;main&lt;/code&gt; (&lt;code&gt;feat/...&lt;/code&gt;, &lt;code&gt;fix/...&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;Ensure &lt;code&gt;npm run check&lt;/code&gt; passes locally.&lt;/li&gt;
&lt;li&gt;Use Conventional Commits.&lt;/li&gt;
&lt;li&gt;Open a pull request.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  If this boilerplate saved you time, a star helps more devs discover it
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://next-elite-boilerplate.vercel.app/" rel="noopener noreferrer"&gt;Live Demo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/salmanshahriar/Next-Elite/generate" rel="noopener noreferrer"&gt;Use Template&lt;/a&gt;&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://vercel.com/new/clone?repository-url=https://github.com/salmanshahriar/Next-Elite" rel="noopener noreferrer"&gt;Deploy on Vercel&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>boilerplate</category>
      <category>betterauth</category>
    </item>
  </channel>
</rss>
