Skip to content

Nextjs with Shadcn(Tailwind v4), husky, commitlint, lint-satged, prettier and eslint integration. Base project template.

Notifications You must be signed in to change notification settings

hugocruzlfc/nextjs-perfect-base-template

Repository files navigation

This is a Next.js project bootstrapped with pnpm dlx create-next-app@latest --use-pnpm.

Getting Started

Clone the repository and run pnpm install to install the dependencies.

Development

Run pnpm dev to start the development server.

Configuration step by step

Install and config each package and create the necessary files for his configuration.

Commitlint

See the commitlint guide and local setup

pnpm add --save-dev @commitlint/{cli,config-conventional}

Create the commitlint configuration file

echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.ts

Husky

pnpm add --save-dev husky
pnpm husky init
echo "pnpm dlx commitlint --edit \$1" > .husky/commit-msg

Commitizen and cz-conventional-changelog

See the commitizen cz-cli guide

pnpm add -D commitizen
pnpm dlx commitizen init cz-conventional-changelog --pnpm --save-dev --save-exact

Create prepare-commit-msg hook to run commitizen

echo "exec < /dev/tty && node_modules/.bin/cz --hook || true" > .husky/prepare-commit-msg

Prettier and plugins

pnpm add -D prettier eslint-config-prettier eslint-config-prettier eslint-plugin-prettier

Create the prettier configuration file

echo "export default {plugins: ['prettier-plugin-organize-imports','prettier-plugin-tailwindcss'],
tailwindFunctions: ['clsx'],};" > prettier.config.mjs

Lint-staged

pnpm add -D lint-staged

And in the pre commit husky hook copy the following:

npx lint-staged

And the package.json copy the following:

 "devDependencies": {
   ....
  },
  "lint-staged": {
    "*.{js,ts}": [
      "eslint --fix",
      "prettier --write"
    ],
    "*.{md,html,json}": "prettier --write"
  },

About

Nextjs with Shadcn(Tailwind v4), husky, commitlint, lint-satged, prettier and eslint integration. Base project template.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published