Starting a NextJS project can be quite time-consuming and tedious. So why waste your precious time when you can have pretty much everything you need to start a new Next.js project packed in this Starter Kit
Thank you to Kahlil for the inspiration. I've started by forking the repo and ended up making quite some changes.
Added eslint and prettier from paulintrognon.fr.
- Type System with Typescript
- Linting with Eslint & Prettier
- Code Analysis with Github super-linter
- Ui Library Chakra UI
- Pre-commit hooks with Pretty Quic & Husky
- Unit Testing with Jest & Texting Library
- E2E Testing with Cypress
- CI/CD with Github Actions
You can use this Starter Kit in a couple of different ways.
- You can use this starter kit as an example for NextJs
yarn create next-app my-app --example https://github.com/alveshelio/next-chakra-ui-starter-kit
- You can generate a new Repo from this one with github.com/alveshelio/next-chakra-ui-starter-kit
- You can clone this repo
git clone https://github.com/alveshelio/next-chakra-ui-starter-kit my-app
cd my-app
- Install dependencies
yarn install
- Start the server
yarn dev
- Hit the ground running with Next.js, TypeScript & Chakra UI
Please refer to the respective docs (linked above) in order to learn about these technologies.
This starter kit is using Github Actions to handle the CI / CD. Whenever we commit to a branch or main we are
going to run the linter, unit tests and e2e tests. And when we push to main we are going to publish the site to
Amazon S3.
If you are using a different CI / CD you'll need to remove all the files in directory .github/workflows
If you don't wish to analyse your code with super-linter you can simply remove file .github/workflows/linter.yml
You're not using NextJS as a Static Site Generator (SSG)
First you need to change the script build
in package.json
to
"build": "next build"
.
Then you need to remove file .github/workflows/deploy.yml
The Github action configured in this starter kit will deploy a static site to an Amazon S3 bucket, if you want to
deploy to another provider, in that case you need to updated
file . github/workflows/deploy.yml
to suite your platform needs.
You could be tempted to use const { colorMode, toggleColorMode } = useColorMode()
to toggle the theme color
directly within a page, don't do that. colorMode
will always return undefined.
You need to use usetColorMode()
hook within a component and import this component in the page where you want to use it.
I recommend you use n to manage your Node and Yarn versions.
MIT