Based on ixartz's Next-js-boilerplate
The original boilerplate was designed for full-stack applications. While the original template is well-crafted, it is strongly opinionated in the packages it offers (ie. auth, logging etc.). This fork aims to offer a flexible alternative that doesn't rely on third-party online services.
Developer experience first, extremely flexible code structure and only keep what you need:
@
prefix├── README.md # README file
├── .github # GitHub folder
├── .husky # Husky configuration
├── .storybook # Storybook folder
├── .vscode # VSCode configuration
├── public # Public assets folder
├── src
│ ├── app # Next JS App (App Router)
│ ├── components # React components
│ ├── libs # 3rd party libraries configuration
│ ├── locales # Locales folder (i18n messages)
│ ├── css # Css folder
│ ├── types # Type definitions
│ ├── utils # Utilities folder
│ └── validations # Validation schemas for zod
├── tailwind.config.js # Tailwind CSS configuration
└── tsconfig.json # TypeScript configuration
Run the following command on your local environment:
git clone --depth=1 https://github.com/tpkee/nextjs-boilerplate.git my-project-name
cd my-project-name
npm install
Then, you can run locally in development mode with live reload:
npm run dev
Open http://localhost:3000 with your favorite browser to see your project.
NextJS Boilerplate comes with a built-in bundle analyzer. It can be used to analyze the size of your JavaScript bundles. To begin, run the following command:
npm run build-stats
By running the command, it'll automatically open a new browser window with the results.
If you are VSCode users, you can have a better integration with VSCode by installing the suggested extension in .vscode/extension.json
. The starter code comes up with Settings for a seamless integration with VSCode. The Debug configuration is also provided for frontend and backend debugging experience.
With the plugins installed on your VSCode, ESLint and Prettier can automatically fix the code and show you the errors. Same goes for testing, you can install VSCode Jest extension to automatically run your tests and it also show the code coverage in context.
Pro tips: if you need a project wide type checking with TypeScript, you can run a build with Cmd + Shift + B on Mac.
Everyone is welcome to contribute to this project. Feel free to open an issue if you have question or found a bug. Totally open to any suggestions and improvements.