salmanshahriar/Next-Elite
À propos
👑 Next.js Starter Kit, Boilerplate & Template for SaaS and Admin Dashboards. Frontend-focused & built for Developer Experience: Next.js 16.4 + TypeScript 7 + React 19.3, Tailwind v4, shadcn/ui, Better Auth, RBAC, i18n, SEO + PWA, Oxlint, Oxfmt, Vitest, Playwright, and more.
Développement web et applicatifProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- +1
- in 1 month
- +9
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalNext Elite
An open source Next.js Starter Kit, Boilerplate & Template for SaaS and Admin Dashboards. Frontend-focused with UI components, i18n, RBAC, a polished DX and more. Designed to integrate with external backends APIs through (REST, GraphQL, or a BFF), it provides a solid foundation with pre-built authentication, dashboard layouts, and reusable UI components.
🚀 Live Demo · 📦 Use this Template · 🐛 Report Bug · ✨ Request Feature
https://github.com/user-attachments/assets/519cc07b-7374-413f-b390-9a94f992b0f3
Next Elite
|
50+ Custom Components
|
Auth Layouts
|
Dashboard Layouts
|
Highlights & Features:
- Next.js 16.4 + React 19.3 - Fast App Router, Turbopack, and Server Actions
- TypeScript 7 - End-to-end type safety across components and routes
- Oxlint + Oxfmt - Blazing-fast linting & formatting with Lefthook pre-commit hooks
- Next.js Best Practices - Feature-based architecture and a standalone, multi-arch Docker build
- Lean & Fast by Default - ~184 KB Brotli first load, lazy-loaded auth, charts & menus, and per-page JS budgets enforced in CI
- AI Agent Ready -
AGENTS.mdand aproject-standardsskill in.agents/skills/keep AI coding agents on the project's conventions - Authentication & RBAC - Email/Password & Google OAuth via BetterAuth with permission-based RBAC
- Auth & Dashboard Layouts - Split-pane auth layout & role-based dashboard layout with fixed sidebar navigation
- 50+ Custom & Reusable UI Components - Accessible shadcn/ui primitives built with Tailwind CSS v4 & Radix UI
- Accessibility Baseline - Skip links, unique page titles, focus-visible rings, WCAG-minded contrast tokens, reduced-motion support, and RTL-safe logical properties
- Type-Safe i18n - Cookie-based multi-language support (6 locales, LTR + RTL) powered by next-intl
- SEO & PWA Suite - OpenGraph metadata, dynamic sitemap, robots.txt, web manifest, and llms.txt
- Comprehensive Testing - Unit/component testing with Vitest and E2E testing with Playwright
- Next Elite Server (Coming Soon) - Companion backend
🚀 One-click Deploy to Vercel
Set environment variables from .env.example in Vercel project settings.
💻 Tech Stack + Details
Frameworks & Core
- Next.js 16.4 (App Router) - Fast, modern React framework with Turbopack.
- TypeScript 7 - End-to-end type safety for rock-solid refactoring and developer experience.
- Node.js 22.18+ - Built on the Node.js 22 LTS runtime.
Authentication & Access Control
- BetterAuth - Out-of-the-box email/password and Google OAuth authentication using
/api/auth/*route handlers. - Auth UI & Layout - Split-pane authentication pages with an animated globe background (lazy-loaded, desktop only).
- Role-Based Access Control (RBAC) -
userandadminroles. OnerequireUser()check in the protected layout picks the@adminor@userparallel route slot;useAuth().hasPermission()handles in-page checks. - Dashboard & Navigation - Modern sidebar and Logout actions, mobile sheet, and topbar breadcrumbs.
Internationalization (i18n)
- next-intl - Type-safe, cookie-based localizations (no URL prefix). Translation keys are type-checked (
t("key")works; typos fail compile-time).
UI & Styling
- Tailwind CSS 4 - Utility-first styling with
@tailwindcss/postcssandtw-animate-css. - Design Tokens - Light and dark color, radius, and spacing tokens in
src/app/styles/tokens.css(no hard-coded colors; semantic colours tuned for WCAG AA contrast). - shadcn/ui - Highly customizable UI components built with Tailwind CSS, Radix UI, and CVA.
- Theme Support - System-preference default with light/dark toggle,
color-schememeta/CSS, and reduced-motion-aware transitions.
API & Data Fetching
- TanStack Query (React Query) - Pre-configured
QueryProviderin the protected layout (src/components/shared/query-provider.tsx) with sensible defaults (staleTime,gcTime, retry). Ready to wireuseQuery/useMutationhooks to your REST, GraphQL, or BFF endpoints.
Observability & Infrastructure
- Sentry Integration - Error tracking and performance instrumentation for client and server.
- Vercel Analytics - Page analytics via
@vercel/analytics, rendered only when deployed on Vercel. - Health Probes - Direct
GET /api/healthendpoint for load balancers.
Quality Gates & Tooling
- Validated Config - Env vars are validated on the server with T3 Env.
- Hygiene & Linting - Oxlint and Oxfmt for fast linting and formatting, plus Knip for dead code/dependency hygiene.
- Testing Suite - Unit/component testing with Vitest and React Testing Library, and E2E testing with Playwright.
- Git Hook Automation - Lefthook pre-commit hooks (oxlint + oxfmt), Commitlint for conventional commits, and a pre-push hook that runs
npm run check.
📈 Lighthouse Report
📦 Bundle Size
First-load JS with Brotli (gzip in brackets), including ~112 KB br of Next.js + React. Enforced by npm run size; inspect with npm run analyze.
| Page | Size (after npm run demo:remove) |
|---|---|
/ |
177 KB br (204 KB gz) |
/login |
207 KB br (238 KB gz) |
/dashboard |
221 KB br (254 KB gz) |
⚡ Quick Start
Prerequisites
- Node.js 22.18 or later
- npm
Local Setup
- Clone the repository and navigate into it:
git clone https://github.com/salmanshahriar/Next-Elite.git cd Next-Elite - Install dependencies:
npm install - Set up your environment variables:
cp .env.example .env - Start the development server:
npm run dev
Open http://localhost:6767 to view your local instance.
Demo Credentials
When NEXT_PUBLIC_DEMO_MODE=true, the login screen includes a quick-fill panel with these seed credentials:
| Role | Password | |
|---|---|---|
| User | [email protected] |
12345678 |
| Admin | [email protected] |
12345678 |
[!NOTE] Keep
NEXT_PUBLIC_DEMO_MODE=falsefor production (that is already the.env.exampledefault).
Removing the Demo Code
All demo code (landing page, /ui-components showcase, promo logos, demo accounts) lives in src/_demo(DELETE)/. When you're ready to build your own app, run:
npm run demo:remove
npm run check
Docker & Production Containerization
The production setup uses a multi-stage Google Distroless base image (gcr.io/distroless/nodejs22-debian12) for maximum security, zero unnecessary OS packages, and minimal image size.
Run the application locally via Docker:
cp .env.example .env
docker build $(grep '^NEXT_PUBLIC_' .env | sed 's/^/--build-arg /') -t next-elite .
docker run --rm --env-file .env -p 6767:6767 next-elite
NEXT_PUBLIC_* values are baked in at build time, so they're passed as build args from .env.
Or using Docker Compose (reads the same build args from .env):
docker compose up --build
Multi-Arch Deploy (ARM64 + AMD64)
docker buildx create --name multiarch --use # one-time setup
docker buildx build --platform linux/amd64,linux/arm64 -t next-elite .
Dokploy Deployment
This template is ready for Dokploy.
🧩 Architecture Overview
Server-render what needs SEO, check the session once, render the app on the client, and fetch data from your API.
flowchart LR
subgraph Public["(public) · SEO"]
direction TB
P["Server Components<br/>metadata · sitemap · OG"]
end
subgraph Auth["(auth) · sign in"]
direction TB
F["Client forms<br/>Better Auth loaded on submit"]
end
subgraph App["(protected) · app"]
direction TB
G["Layout: requireUser()<br/>one server check"] --> R{role}
R -->|admin| A["@admin pages"]
R -->|user| U["@user pages"]
end
API[("Your API<br/>REST · GraphQL · BFF")]
Public --> Auth --> App
A & U -->|TanStack Query| API
| Route group | Renders | Auth | Data |
|---|---|---|---|
(public) |
Server (SEO) | Reads the session for the header only | Server |
(auth) |
Server shell, client forms | Better Auth client loads on submit | - |
(protected) |
Client | requireUser() once, role picks a slot |
TanStack Query → your API |
No database in the frontend, no client session polling, and a per-page JS budget in CI.
⚙️ Configuration
Environment variables
Every variable is documented in .env.example and validated by src/libs/env.ts (T3 Env).
Site & SEO configuration
src/features/site/site.config.json is the central place for SEO metadata, dynamic sitemaps, localized routes, and PWA manifest:
{
"appName": "Next Elite",
"domain": "https://yourdomain.com",
"tagline": "Frontend-first, API-driven, batteries included.",
"title": "Next Elite - Production-Ready SaaS Boilerplate",
"description": "Frontend-first Next.js 16.4 + React 19 boilerplate with i18n, RBAC and BetterAuth."
}
Adding a Language
- Add the locale code to
languages.supportedinsite.config.jsonand add an entry underlanguages.locales. - Create
messages/<locale>.jsonmirroringmessages/en.json. - The
next-intlruntime picks it up automatically; types update fromsrc/global.d.ts.
Adding a Role
- Append the role to the
UserRoleunion insrc/features/auth/rbac/permissions.ts. - Map permissions for the role in
ROLE_PERMISSIONSin the same file. - Optional: add a parallel route slot -
src/app/(protected)/@<role>/...- and update(protected)/layout.tsxto render it based on permissions.
🧪 Development & Testing
Scripts
| Command | Description |
|---|---|
npm run dev |
Start the dev server (port 6767) |
npm run build |
Production build |
npm run start |
Start the production server (port 6767) |
npm run start:standalone |
Run standalone server (Playwright CI) |
npm run analyze |
Inspect what's in each page's bundle |
npm run typecheck |
tsc --noEmit |
npm run lint |
Oxlint + Oxfmt check |
npm run lint:fix |
Auto-fix with Oxlint + Oxfmt |
npm run knip |
Detect unused files / exports / deps |
npm run check |
CI gate: typecheck + lint + knip + tests |
npm run size |
Check per-page JS budget (after build) |
npm run test |
Vitest run |
npm run test:watch |
Vitest watch mode |
npm run playwright:install |
Download Playwright browsers |
npm run e2e |
Playwright E2E |
Testing Details
- Unit / component: Vitest + React Testing Library (
config/vitest.config.ts). Tests live insrc/tests/, mirroring thesrc/folder structure (*.test.ts/*.test.tsx). UserenderWithProvidersfrom@/tests/renderfor components that need app context (i18n, theme, auth, React Query). Plainrenderis fine for isolated UI primitives. - End-to-end: Playwright in
e2e/on port 6767 (127.0.0.1). Local runs usenext dev(all browsers); CI uses productionnext start(Chromium only). Runplaywright:installbefore the first E2E run; on Linux, also runnpx playwright install-deps(sudo). Usenpm run e2e -- --uifor UI mode or--project=webkitfor one browser. Stopnpm run devbeforenpm run e2e- E2E starts its own server.
CI/CD Pipeline
.github/workflows/check.yml- typecheck → lint → knip → unit tests → build → bundle size budget, on every push and PR. A second job runsdemo:removeand the same checks..github/workflows/playwright.yml- build → Playwright E2E (Chromium, production server)..github/dependabot.yml- weekly npm and GitHub Actions update PRs.
🎯 When to Use
Next Elite is best for:
- SaaS apps with multiple user roles.
- Multi-lingual/Internationalized products (LTR + RTL).
- Frontends consuming an existing backend or BFF.
- Projects requiring a clean, feature-based modular structure.
It is probably overkill for:
- Single-page landing sites.
- Apps that need a tightly-coupled DB layer (API-only design).
🤝 Contributing
Contributions to Next-Elite are welcome.
- Fork the repository and create a branch from
main. - Use clear branch names such as
feat/...,fix/..., ordocs/.... - Run
npm run checkbefore submitting your changes. - Follow Conventional Commits.
- Open a Pull Request with a clear description of your changes.
📜 License
MIT LICENSE
⭐ Support Next-Elite
If you find Next-Elite useful, consider giving it a ⭐ Star on GitHub.
Thanks for reading!
Explorer des projets similaires
Chargement…