Skip to content

sudo-ditto/nextjs-ts-jest-rtl-boilerplate

Repository files navigation


Logo

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

github npm linkedin twitter
Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Project Status
  5. Support Me
  6. Deployment
  7. Roadmap
  8. Contributing
  9. License
  10. Contact
  11. Acknowledgements

About The Project

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!).

Built With

This section lists any major frameworks and tools that I used to build this boilerplate.

Getting Started

Installation and Setup

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

Getting Started

Prerequisites

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 removing node_modules in Windows.
    npm install -g rimraf

Usage

Scripts

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 run npm 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: Runs lint 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 uses onchange 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 .husky
  • npm 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 - Husky

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.

Project Status

Current

Completely configured boilerplate.

Support me

"Buy Me A Coffee"

Donate

Deployment

  • 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.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Author

Loretta Krasteva

github npm linkedin twitter

Project Link: nextjs-ts-rtl-jest-prettier-boilerplate

Acknowledgements

Deep appreciation to my greatest assistant: