NextJS, Typescript, Ant Design, SASS, Redux Toolkit, Jest, React Testing Library, Prettier Boilerplate
The Ultimate NextJS Template
Explore the docs »
View on npm
·
Report Bug
·
Request Feature
Table of Contents
As a professional developer that loves doing side projects in my free time, it just puts me off to think about having to spend a day or two just configuring my project rather than coding. Therefore I created the ultimate boilerplate project and with utmost pleasure and excitement I share it with all of you so that you can get started with coding right away!
This is a starter template (boilerplate) project that uses NextJS, Typescript, SASS, Redux Toolkit, RTL (React Testing Library), Jest, ESlint, Prettier and Git Hooks (Husky). It is everything that you need to get started and has the most useful react scripts already added. Check Scripts for more information.
It has the best linter rules to get started with, as well as the eslint-plugin-jsx-a11y
accessibility plugin to write the best code possible. These are initial configurations that you are not bound to and can be customized to your liking. You can easily make your own configurations, change some of the used frameworks (you could swap SASS for MUI or some other styling framework that you love!).
This section lists any major frameworks and tools that I used to build this boilerplate.
Alternatively, clone down the repository.
You will need node
and npm
installed globally on your machine.
Installation:
npm install
To Start Dev Server:
npm run dev
To Visit App:
localhost:3000
This is an example of how to list things you need to use the software and how to install them.
- npm
npm install npm@latest -g
- onchange - used in the scripts to listen for changes in files and automatically format them for you.
npm install -g onchange
- rimraf - needed in the
clean
script. It's used to bypass issues with removingnode_modules
in Windows.npm install -g rimraf
I've added the following scripts for convenience. Feel free to modify them to your liking.
npm start
: Starts your production build. Requires you to runnpm run build
beforehand.npm run dev
: Starts the development server, initially formats all of your code and runs prettier watch mode.npm run build
: Build your code for production.npm run lint
: Runs ESlint to check and fix errors automatically. This script is used by Husky.npm run lint:fix
: Runslint
and fixes any found errors.npm run prettier
: Outputs prettier errors.npm run prettier:fix
: Fixes all prettier errors.npm run prettier-watch
: This script usesonchange
to watch for any changed files and fixes them automatically.npm run format
: Formats all of your files based on both prettier and eslint configs.npm run prepare
: Prepares .huskynpm run test
: Runs jest configuration.npm run test:watch
: Runs jest watch mode.npm run clean
: Removes node_modules and package-lock.json.npm run reinstall
: Creates a clean installation.
Git Hooks are a really handy tool for automating tasks around git. I've initialized husky and added the following hook:
pre-commit
hook: Checks for eslint errors and fixes them automatically for you when you are commiting. Once it has finished its job, your commit is finished.
Feel free to add more hooks. Read more about husky.
Completely configured boilerplate.
npm run build
- Builds the app for production. It correctly bundles React in production mode and optimizes the build for the best performance. Your app is ready to be deployed!
Once you have ran npm run build
, you can run the production build locally with npm start
.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Project Link: nextjs-ts-rtl-jest-prettier-boilerplate
Deep appreciation to my greatest assistant: