Skip to content
SaaS Templates Tailwind CSS 4 nextjsreacttypescriptradix-ui

React Next.js 16.4 SaaS Starter with Auth - Next Elite

A Next.js 16.4 starter kit with Tailwind CSS, TypeScript, and built‑in authentication and dashboard layouts for SaaS applications.

By salmanshahriar salmanshahriar/next-elite 134 stars

Introduction

Next Elite is an open‑source starter kit for building SaaS and admin dashboard applications with Next.js 16.4, React 19, TypeScript 7 and Tailwind CSS 4. It includes ready‑made authentication, role‑based access control, dark mode, internationalisation and a collection of reusable UI components.

What this project offers

  • A complete Next.js app router structure with separate routes for public, authentication and protected pages.
  • Built‑in authentication using better‑auth (email/password and Google OAuth).
  • Role‑based access control (RBAC) for user and admin roles.
  • Type‑safe internationalisation powered by next‑intl with six locales.
  • Dark mode support that follows the system preference.
  • Over 50 custom UI components based on shadcn/ui, Radix UI and Tailwind CSS.
  • Server‑side error tracking with Sentry.
  • Dockerfile for containerised deployment.
  • Testing setup with Vitest (unit) and Playwright (end‑to‑end).

Main features

FeatureDescription
Auth LayoutsSplit‑pane login/register pages with lazy‑loaded background.
Dashboard LayoutsSidebar navigation, top bar, and role‑based content slots.
Type‑safe i18nCompile‑time checked translation keys, cookie‑based locale selection.
Dark ModeSystem‑default theme with toggle and reduced‑motion support.
RBACSimple permission checks via useAuth().hasPermission().
Custom UI ComponentsAccessible primitives built with Tailwind CSS 4, Radix UI and CVA.
Server ActionsReady for Next.js server actions in the app router.
Docker supportMulti‑arch Dockerfile included.
TestingVitest unit tests and Playwright E2E tests configured.

Technology stack

  • Framework: Next.js 16.4 (App Router)
  • UI: React 19, Tailwind CSS 4, shadcn/ui, Radix UI
  • Language: TypeScript 7
  • Styling: PostCSS 8, Tailwind CSS 4
  • State & Data: @tanstack/react‑query
  • Authentication: better‑auth
  • Internationalisation: next‑intl
  • Observability: @sentry/nextjs
  • Testing: Vitest, Playwright
  • Containerisation: Docker

Requirements

  • Node.js >= 22.18.0 (as defined in package.json engines field)

Installation

  1. Download the project
curl -L -o next-elite.zip /download/next-elite.zip
unzip next-elite.zip -d next-elite
cd next-elite
  1. Install dependencies
npm ci
  1. Build the application (required before running)
npm run build

The build creates a .next folder. The production server files are in .next/standalone and the static assets are in .next/static.

  1. Start the development server (optional, for local testing)
npm run dev

The app will be available at http://localhost:6767.

  1. Run the production server (after a successful build)
npm run start

Or use the standalone build:

npm run start:standalone

Configuration

  • Environment variables are defined in .env.example. Copy it to .env.local and adjust values such as database URLs, OAuth client IDs, and Sentry DSN.
  • Docker configuration is provided in Dockerfile and docker-compose.yml. Build the image with docker compose build and run with docker compose up.
  • Linting and formatting are set up with oxlint and oxfmt; they run automatically via a Lefthook pre‑commit hook (npm run prepare).

Customizing the project

  • UI components live in src/components/ui and can be extended or replaced.
  • Tailwind configuration is in tailwind.config.cjs (generated by the Tailwind package). Adjust colors, spacing, or add plugins there.
  • Internationalisation files are under src/messages (e.g., en.json, fr.json). Add new locale files and update next-intl configuration in src/app/i18n.ts.
  • Authentication logic is in src/app/(auth) and the API route src/app/api/auth. Modify the BetterAuth options to integrate your own user store.

Project structure

/
├─ Dockerfile
├─ docker-compose.yml
├─ next.config.ts
├─ package.json
├─ postcss.config.mjs
├─ public/                # static assets (images, icons)
├─ scripts/               # helper scripts (bundle size, demo removal)
├─ src/
│  ├─ app/                # Next.js app router (auth, protected, public)
│  ├─ components/         # UI components (auth, layout, shared, ui)
│  ├─ features/           # feature modules (auth, i18n, site)
│  ├─ hooks/              # custom React hooks
│  ├─ libs/               # utility libraries (env, query client)
│  └─ tests/              # Vitest and Playwright tests
└─ tsconfig.json

Tips

  • Run npm run typecheck to verify TypeScript types without emitting files.
  • Use npm run lint and npm run lint:fix to keep code style consistent.
  • To see bundle size, execute npm run size.
  • For fast feedback, run Vitest in watch mode: npm run test:watch.
  • Playwright browsers can be installed separately with npm run playwright:install.

License and attribution

The project is licensed under the MIT License. See the LICENSE file in the repository.

Original repository: https://github.com/salmanshahriar/next-elite

When redistributing, keep the license file and credit the author as required by the MIT license.