Table of Contents
π Simple templete with base configurations written in Next.js, Tailwind CSS and TypeScript.
β‘οΈ Made with developer experience first: Next.js, TypeScript, ESLint, Prettier, Husky, Zustand, VSCode, Docker, Tailwind CSS, HeadlessUI.
Clone this project and use it to create your own Next.js project.
This section should list any major frameworks/libraries used to bootstrap our project.
Instructions on setting up project locally.
- Node.js (>= 14.19.0) and npm
- Yarn (>= 1.22.0)
- βπ» Minimal code
- π SEO-friendly
- π Production-ready
Developer experience first:
- π₯ Next.js for Static Site Generator
- π¨ Integrate with Tailwind CSS and Headless UI
- π
PostCSS for processing Tailwind CSS and integrated to
styled-jsx - π Type checking TypeScript
- β Strict Mode for TypeScript and React 18
- βοΈ Linter with ESLint (default NextJS, NextJS Core Web Vitals and Airbnb configuration)
- π Code Formatter with Prettier
- π¦ Husky for Git Hooks
- π VSCode configuration: Debug, Settings, Tasks and extension for PostCSS, ESLint, Prettier, TypeScript
- π€ SEO metadata, JSON-LD and Open Graph tags with Next SEO
- π³ One command deployment with Docker
Built-in feature from Next.js:
- β Minify HTML & CSS
- π¨ Live reload
- β Cache busting
-
Get a free API_URL at https://example.com
-
Install packages
yarn
-
Touch .env file
touch .env
-
Enter your API_URL in
API_URL=https://example.com NEXT_PUBLIC_API_URL=https://example.com -
Then, you can run locally in development mode with live reload:
yarn dev
Open http://localhost:3000 with your favorite browser to see your project. For your information, Next JS need to take some time to compile the project for your first time.
- folders & custom hooks -> camel case
- files in pages (routing) -> kebab case
- files in other folders -> pascal case
- custom hooks, modules, enums: -> [...].ts
- pages + components: -> [...].tsx
.
βββ README.md # README file
βββ next.config.js # Next JS configuration
βββ public # Public folder
β βββ images # Image used by default template
β βββ png
β βββ jpg
β βββ svg
βββ src
β βββ components # All app components, separate by modules, pages
β βββ example # Example components
β β βββ Logo.tsx # Logo components
β β βββ ... # others
β β
β βββ home # Homepage components
β
β βββ data # JSON file to render text, internal data files,...(naming & structure same components)
β βββ layout # Atomic layout component
β βββ pages # Next JS pages
β βββ services # Separate logic modules, custom hooks,...(naming & structure same components)
β βββ stores # Zustand files (create store, interface, logic,...)
β βββ styles # Global & modules CSS files
β βββ templates # Default template
β βββ types # Interfaces, class, generic,... (naming & structure same components)
β βββ utilities # Utility folder (enums, utils modules,...)
βββ tailwind.config.js # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ Dockerfile # Dockerfile
βββ docker-compose.yml # docker-compose configuration
βββ ... # Other configuration files (prettier, ignore files,...)
yarn run test-all
You can see the results locally in production mode with:
$ yarn build
$ yarn start
The generated HTML and CSS files are minified (built-in feature from Next js). It will also removed unused CSS from Tailwind CSS.
You can create an optimized production build and you deploy with any hosting service by Docker:
$ docker-compose up --build -d
If you are VSCode users, you can have a better integration with VSCode by installing the suggested extensions and settings in .vscode
yarn add -D @commitlint/{config-conventional,cli}
npx husky add .husky/commit-msg ""
<type>(<scope>): <short summary>
β β β
β β βββ«Έ Summary in present tense. Not capitalized. No period at the end.
β β
β βββ«Έ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
β elements|forms|http|language-service|localize|platform-browser|
β platform-browser-dynamic|platform-server|router|service-worker|
β upgrade|zone.js|packaging|changelog|docs-infra|migrations|
β devtools
β
βββ«Έ Commit Type: build|ci|chore|docs|feat|fix|perf|refactor|revert|style|test
Must be one of the following:
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- ci: Changes to our CI configuration files and scripts (examples: CircleCi, SauceLabs)
- chore: add something without touching production code (Eg: update npm dependencies)
- docs: Documentation only changes
- feat: A new feature
- fix: A bug fix
- perf: A code change that improves performance
- refactor: A code change that neither fixes a bug nor adds a feature
- revert: Reverts a previous commit
- style: Changes that do not affect the meaning of the code (Eg: adding white-space, formatting, missing semi-colons, etc)
- test: Adding missing tests or correcting existing tests
The <type> and <summary> fields are mandatory, the (<scope>) field is optional.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- 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.txt for more information.
I've included a few of my favorites to kick things off!