Skip to content

remcolakens/next-boilerplate

Repository files navigation

Remco's Next.js Boilerplate

Easy to use front-end boilerplate to start developing your Next.js application right away πŸ’―

Learn More


Highlights

  • Features all of the benefits of Next.js
  • Typescript support
  • Blazing fast package manager
  • Lint your code with husky & lint-staged
  • Normalizes default browser styles
  • Automatically formats your code by using Prettier
  • JavaScript Testing Framework
  • Friendly errors & warnings
  • Automated releases with semantic-release and Github Actions
  • Includes Tailwind CSS & shadcn/ui to quickly build user-friendly interfaces
  • Automatically optimizes all your SVGs

File Tree

β”œβ”€β”€ .github                   # Workflows for Github Actions
β”œβ”€β”€ .husky                    # Git hooks
β”œβ”€β”€ app                       # Pages folder
β”œβ”€β”€ __tests__                 # Test folder
β”‚   └── __snapshots__         # Snapshot folder
β”‚       └── snapshot.tsx.snap # The saved snapshots
β”‚   └── index.test.tsx        # Sample test file
β”‚   β”œβ”€β”€ components            # Components folder
β”‚   β”œβ”€β”€ lib                   # Library folder
β”‚   β”œβ”€β”€ svgs                  # SVG folder
β”‚   β”œβ”€β”€ favicon.ico           # The favicon
β”‚   β”œβ”€β”€ globals.css           # The main css file to configure globals such a tailwind
β”‚   β”œβ”€β”€ layout.tsx            # The main layout files
β”‚   └── page.tsx              # Sample page
β”œβ”€β”€ docs                      # Documentation
β”‚   └── CHANGELOG.md          # the changelog
β”‚   └── ci.md                 # docs for CI
β”‚   └── commit-convention.md  # docs for commit convention
β”œβ”€β”€ public                    # Folder for static assets
β”œβ”€β”€ .commitlintrc             # commitlint config (package)
β”œβ”€β”€ .czrc                     # Config to commitizen
β”œβ”€β”€ .editorconfig             # Config to normalize editors
β”œβ”€β”€ .env.example              # Example file with required .env variables
β”œβ”€β”€ .eslintrc                 # Eslint config
β”œβ”€β”€ .gitignore                # Files that will be ignored by git
β”œβ”€β”€ .lintstagedrc.js          # Config file for "lint-staged" (package)
β”œβ”€β”€ .nvmrc                    # Compatible node version
β”œβ”€β”€ .prettierignore           # Files that will be ignored by Prettier (package)
β”œβ”€β”€ .prettierrc               # Prettier config (package)
β”œβ”€β”€ .releaserc                # semantic-release config
β”œβ”€β”€ .svgrrc                   # config for SVGR
β”œβ”€β”€  CODE_OF_CONDUCT          # the CODE OF CONDUCT
β”œβ”€β”€  jest.config.js           # Config file for jest
β”œβ”€β”€  jest.setup.js            # Used for __tests__/testing-library.js
β”œβ”€β”€  LICENSE                  # License information
β”œβ”€β”€  next-env.d.ts            # Next.js Typescript declaration file (leave unchanged)
β”œβ”€β”€  package.json             # The package.json of this project
β”œβ”€β”€  pnpm-lock.yaml           # Lock file for packages (leave unchanged)
β”œβ”€β”€  postcss.config.js        # the postcss config file
β”œβ”€β”€  README.md                # README documentation
β”œβ”€β”€  tailwind.config.ts       # the tailwind css config
└──  tsconfig.json            # Typescript config

Usage

For new projects you should be using pnpm as your package manager. It has some advantages over yarn and npm but it's main purpose is to be a fast and disk space efficient.

If you are new to pnpm you need to install it on your local machine, afterwards you can follow the instructions below.

# Install dependencies

pnpm install

# Install playwright for end-to-end tests

pnpm exec playwright install --with-deps

# Start local webserver at port 3000

pnpm dev

# Run linters

pnpm lint

# Run unit tests

pnpm test

# Run end-to-end tests

pnpm test:e2e

# Build app for production (gets output in the 'dist' directory)

pnpm build

# Start production server

pnpm start

Learn More

To learn more about Next.js and the other tools, take a look at the following resources:

  • Next.js Documentation - learn about Next.js features and API.
  • Typescript - Introduction to TypeScript
  • pnpm - Fast, disk space efficient package manager
  • Tailwind CSS - A utility-first CSS framework packed with classes that can be composed to build any design, directly in your markup.
  • Eslint - Find and fix problems in your JavaScript code.
  • Prettier - Prettier is an opinionated code formatter.
  • Jest - Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
  • React Testing Library - Simple and complete testing utilities that encourage good testing practices
  • Conventional Commits - A specification for adding human and machine readable meaning to commit messages
  • semantic-release - Fully automated version management and package publishing

Deploy

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Deploy with Vercel

Documentation

  • CHANGELOG - Changelog with all notable changes made to a project
  • CI - Short explanation of the continuous integration process
  • Commit Convention - Short introduction of the commit convention

Todo

  • Write README.md
  • Add UI Library e.g. Chakra UI
  • Add React Testing Library
  • Add automated releases
  • Add more examples

License

MIT