Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

141 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Next.js 16 Template

Next.js 16 - a modern template repo

A Next.js 16 template with modern tooling and CI/CD automation. Code quality checks (linting, formatting, type checking, testing) run via Lefthook locally and GitHub Actions on PRs. Dependency updates automated via Dependabot. Deployments handled by Vercel: Preview for PRs, Production for main. Assumes Claude Code.

Homepage in light and dark modes with UI library guidance

Template homepage with light/dark mode setup β€” UI component library still needed

See this template live β€” https://nextjs-base-hello.vercel.app

🎯 Use This Template

(1) Get This Repo. Click "Use this template" β†’ creates a new repository on your GitHub with no commit history β€” a fresh start. Then clone it locally:

git clone https://github.com/YOUR-USERNAME/YOUR-REPO.git
cd YOUR-REPO

# Install dependencies
npm install

# For Claude Code typescript-lsp plugin
npm install -g typescript-language-server typescript

# Claude Code uses for browser exploration (Global chosen)
npm install -g @playwright/cli@latest

# Ensure latest Playwright CLI skill
playwright-cli install --skills

# Open http://localhost:3000 to see app running
npm run dev

(2) Install Extensions. In VSCode/Cursor install the extensions shown in .vscode/extensions.json

(3) GitHub + Vercel Setup. Follow xdocs/project-setup.md to set up GitHub and Vercel.

(4) Housekeeping. Recommended to remove xdocs/ (these are my working files). Modify .claude/CLAUDE.md, .mcp.json, and .claude/settings.json as preferred β€” note the latter installs my plugins and marketplaces into your clone, manage them with /plugins.

(5) Choose UI Library. Choose one that supports Tailwind 4. shadcn/ui (free) and HeroUI v3 (free) are both LLM friendly and use semantic tokens β€” which makes theming easy. shadcn is ubiquitous so theme it well to stand out β€” tweak-cn and theme-generator are helpful. HeroUI is more visually distinct and extremely LLM friendly; it ships with agent skills too. Tailwind Plus (paid) offers components (Catalyst), assembled UI blocks, and full site templates, but doesn't include semantic tokens so centralised theming takes more manual work.

(6) Decide on Icons. Each UI library above ships with icons β€” shadcn/ui uses Lucide React, Tailwind Plus (Catalyst) uses Heroicons, HeroUI uses Iconify. All three let you swap to a different icon library.

(7) Replace Template Files. Replace app/page.tsx, app/layout.tsx, components/button.tsx, app/globals.css (centralised theming), app/fonts.ts, and components/theme-toggle.tsx (use an icon).

What's Installed?

For exact list see package.json

Category Tool What it does
Runtime Node.js 24 LTS Pinned via .nvmrc; engines in package.json bounds it to the 24 line
Framework Next.js 16.3 Core webapp foundation β€” routing, rendering, API routes, optimisation, and builds
Language TypeScript 7 Static type checking with strict mode enabled β€” native Go compiler, ~5x faster
Styling Tailwind CSS v4 Utility-first CSS framework for rapid styling
next-themes Light/dark mode theming provider
Linting Biome Fast linter and formatter (replaces ESLint + Prettier)
markdownlint-cli2 Lints markdown files for consistent formatting
Testing Vitest Fast unit test runner (Vite-native, Jest-compatible)
Playwright E2E browser testing (Chromium, Firefox, WebKit, Mobile)
Testing Library React component testing utilities
Git Hooks Lefthook Runs checks on commit (lint, typecheck, unit tests) and push (build, E2E tests)
Optimisation React Compiler Automatic memoisation and performance optimisations
Analytics Vercel Speed Insights Real user performance metrics viewable on Vercel
Vercel Web Analytics Privacy-friendly visitor analytics viewable on Vercel

Common Additions for New Projects

When starting a new project from this template, you'll typically add:

  • UI components (shadcn/ui, HeroUI v3, Tailwind Plus, etc.)
  • State management (Zustand, Jotai, or React Context)
  • Data fetching (React Query, SWR, or native fetch with Server Components)
  • Forms (React Hook Form, Zod for validation)
  • Authentication (NextAuth.js, Clerk, or Supabase Auth)
  • Database/ORM (Neon or Supabase with Prisma or Drizzle. Or try Convex!)

Explained banner

Next.js Installation Explained

This template was initialised with the following options and then updated:

# Next.js installer
$ npx create-next-app@latest

Would you like to use TypeScript?      βœ”οΈ Yes
Which linter would you like to use?    βœ”οΈ Biome
Would you like to use React Compiler?  βœ”οΈ Yes
Would you like to use Tailwind CSS?    βœ”οΈ Yes
Would you like your code inside a src/ directory?  ❌ No
Would you like to use App Router? (recommended)    βœ”οΈ Yes
Would you like to customise the import alias (@/* by default)? ❌ No

# Update all dependencies to latest versions
npm outdated                # Check outdated packages (2025-11-20)
npx npm-check-updates -u    # Rewrite package.json with latest
npm install                 # Install updated versions

Config Files Explained

File What Generally In This Project Template
β–’ .gitattributes Git line ending and file type handling Normalises line endings across platforms for consistent Git diffs
β–’ .gitignore Files and directories Git should ignore Prevents build outputs and dependencies from being committed
β–’ .markdownlint-cli2.yaml Markdownlint configuration Disables strict linting rules for practical writing; supports file ignores
β–’ .nvmrc Node.js version pin Single source for the Node major β€” CI reads it via node-version-file, nvm use reads it locally
β–’ .vscode/extensions.json VS Code extension recommendations Useful extensions to use in this Next.js project
β–’ .vscode/settings.json VS Code editor and formatting settings Enables auto-formatting and configures Biome and Tailwind extensions
🌺 .claude/rules/ Claude Code context-aware rules Auto-injected when editing matching file paths
🌺 .claude/settings.json Claude Code permissions + plugins Allow/Deny permissions, plus enabled plugins and marketplaces
🌺 .mcp.json Claude Code MCP config Ref MCP for docs search
🌺 .claude/CLAUDE.md Claude Code project context Documents tech stack for Claude Code (customise!)
πŸ…½ next.config.ts Next.js framework configuration Enables React Compiler and customises Next.js build settings
πŸ…½ package.json Project dependencies and npm scripts Defines project dependencies, scripts, and npm package metadata
πŸ…½ postcss.config.mjs PostCSS plugins config for CSS processing Enables Tailwind CSS v4 processing via PostCSS plugin
πŸ§ͺ biome.json Biome linter and formatter Sets linting rules, formatting style, and import organisation
πŸ§ͺ lefthook.yml Git hooks manager Automates code quality checks on commit and build + E2E tests on push
πŸ§ͺ tsconfig.json TypeScript compiler settings Configures TypeScript compiler options and module resolution behaviour
πŸ§ͺ playwright.config.ts Playwright E2E test runner configuration Sets test browsers (desktop + mobile), parallel execution, and base URLs
πŸ§ͺ .playwright/ Playwright test outputs (custom organisation) Contains test artifacts in test-results/ and HTML playwright-report/ (all Playwright outputs nested under .playwright/ for clean structure)
πŸ§ͺ vitest.config.ts Vitest test runner config Sets up React component testing environment and references vitest.setup.ts
πŸ§ͺ vitest.setup.ts Global test setup Adds helpful test assertions like expect(element).toBeVisible()
πŸš€ .github/dependabot.yml Dependabot config Automated dependency update PRs weekly (npm + GitHub Actions)
πŸš€ .github/workflows/check-lint-type.yml GitHub Actions CI workflow Runs Biome linting/formatting checks and TypeScript type checking on PRs
πŸš€ .github/workflows/test-e2e.yml GitHub Actions CI workflow Runs Playwright E2E tests on PRs (builds production, tests browsers, uploads reports)
πŸš€ .github/workflows/test-e2e-vercel.yml GitHub Actions CI workflow Runs Playwright E2E tests against Vercel Preview deployments (triggered by Vercel)
πŸš€ .github/workflows/test-unit.yml GitHub Actions CI workflow Runs Vitest unit tests on PRs (uses jsdom environment, React Testing Library)

CI/CD Workflow Explained

This diagram shows how CI automation integrates into a typical development workflow:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ’» LAPTOP: Create a new branch (tests on local dev machine)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  git checkout -b feature/add-dark-mode
  β”‚
  β”œβ”€ Commit 1: Add light/dark mode          ⚑ pre-commit hook runs (3s)
  β”‚  β”œβ”€ 🎨 Biome lint and format                βœ… Auto-fixed & staged
  β”‚  β”œβ”€ πŸ” TypeScript type check                βœ… Pass
  β”‚  └─ πŸ§ͺ Vitest unit tests                    βœ… Pass
  β”‚                                               (then committed on all pass)
  β”‚
  β”œβ”€ Commit 2: (some more work here)        ⚑ pre-commit hook runs again
  β”‚
  └─ Commit 3: (some more work here)        ⚑ pre-commit hook runs again

  git push origin feature/add-dark-mode     ⚑ pre-PUSH hook runs (~20s)
     β”œβ”€ πŸ—οΈ  Next.js production build             βœ… Pass
     └─ 🎭 Playwright E2E tests                 βœ… Pass (then pushed to GH)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ☁️  GITHUB: Workflows kickoff on GitHub machines when PR is created
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  Create Pull Request β†’ GitHub Actions triggered automatically
  β”‚
  β”œβ”€ πŸ€– Workflow 1: Lint & Type (biome, tsc)
  β”‚  β”œβ”€ Checkout code
  β”‚  β”œβ”€ Setup Node.js (from .nvmrc)
  β”‚  β”œβ”€ Install dependencies (npm ci)
  β”‚  β”œβ”€ Run Biome checks                        βœ… Pass
  β”‚  └─ Run TypeScript checks                   βœ… Pass
  β”‚
  β”œβ”€ πŸ€– Workflow 2: Unit Tests (vitest)
  β”‚  β”œβ”€ Checkout code
  β”‚  β”œβ”€ Setup Node.js (from .nvmrc)
  β”‚  β”œβ”€ Install dependencies (npm ci)
  β”‚  └─ Run Vitest tests                        βœ… Pass
  β”‚
  └─ πŸ€– Workflow 3: E2E Tests (playwright)
     β”œβ”€ Checkout code
     β”œβ”€ Setup Node.js (from .nvmrc)
     β”œβ”€ Install dependencies (npm ci)
     β”œβ”€ Install Playwright browsers
     β”œβ”€ Build Next.js production
     └─ Run Playwright tests                    βœ… Pass

  ── Meanwhile, Vercel deploys Preview ──────────────────────────

  πŸš€ Vercel: Preview deployment ready
     β”œβ”€ βœ… Vercel deployment status check        (required to merge)
     └─ Sends repository_dispatch event to GitHub

  └─ πŸ€– Workflow 4: E2E Tests (Vercel Preview)
     β”œβ”€ Triggered by Vercel (not PR event)
     β”œβ”€ Runs Playwright against live Preview URL
     β”œβ”€ Tests real Vercel deployment             βœ… Pass
     └─ Reports status back to PR commit

  GITHUB PR Status: βœ… All checks passed

  🐰 CodeRabbit AI Review Complete
  └─ 3 nitpick comments posted:
     β”œβ”€ "Consider using const instead of let" (Button.tsx:12)
     β”œβ”€ "Add JSDoc comment" (ThemeContext.tsx:8)
     └─ "Extract magic string to constant" (utils.ts:45)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ’» Back to Laptop (Addressing 1 out of 3 nitpick comments on open PR)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  β”œβ”€ Commit 4: Use const instead of let     ⚑ pre-commit hook runs

  git push origin feature/add-dark-mode     ⚑ pre-push hook runs (~20s)
     β”œβ”€ πŸ—οΈ  Next.js production build             βœ… Pass
     └─ 🎭 Playwright E2E tests                 βœ… Pass (then pushed to GH)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ☁️  GITHUB (Workflows kick off again on any PR changes)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  New commits pushed β†’ GitHub Actions re-run automatically
  β”‚
  β”œβ”€ πŸ€– Lint & Type                             βœ… Pass
  β”œβ”€ πŸ€– Unit Tests                              βœ… Pass
  └─ πŸ€– E2E Tests                               βœ… Pass

  PR Status: βœ… All checks passed (1 new commit)
  🐰 CodeRabbit: "Looks good! 1 issue resolved."

  Okay I'm ready! [Merge Pull Request] ← Click! πŸŽ‰

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Ruleset Verified: "Protect main branch"     β”‚
  β”‚ βœ… All 5 required status checks passed      β”‚
  β”‚ βœ… Branch is up to date with main           β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  main branch updated (merge commit preserves 4 commits)
  └─ πŸš€ Vercel deployment triggered β†’ Production

Key CI Takeaways

  • Local Hooks β€” Catch issues before commit or reaching GitHub
  • GitHub Actions β€” Validate every PR with fresh environment (reproducible CI)
  • GitHub Ruleset β€” Prevents merging broken code (all checks must pass)
  • Fast Feedback β€” Pre-commit catches 90% of issues locally in ~3s vs ~2min CI wait
  • Quality Gates β€” Code is validated 2Γ— (local + CI) before reaching production

Quick rough notes

Quick Notes

(1) How Vitest Pieces Work Together

1. When you run npm test, Vitest loads vitest.config.ts
2. The config tells Vitest to use jsdom and load `vitest.setup.ts`
3. Your test files can use global test functions and extended matchers
4. The @/* import alias works in tests thanks to `vite-tsconfig-paths`
5. React components are compiled with React Compiler (matching prod)

(2) GitHub - A branch ruleset to be set up to protect main. Includes checks for GitHub workflow jobs to pass before merging PR to main. See xdocs/project-setup.md.

(3) Vercel For Deploys - When you raise a PR it automatically deploys to Vercel Preview and Playwright e2e tests run on that too in addition to GitHub servers. When you merge the PR into main, you are deploying to Vercel prod. See xdocs/project-setup.md.

(4) Claude Code Plugins - Declared under enabledPlugins in .claude/settings.json. A plugin set to false is installed but switched off β€” deliberate, not broken. Switch one on via /plugin only when you actually need it, since every enabled plugin adds always-on context to each session (claude plugin details <name>@<marketplace> shows the token cost).

About

Next.js16 template with modern tooling, automated testing, CI/CD via GitHub Actions, deploy to Vercel

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages