Home

Awesome

React Boilerplate Template

A powerful and flexible boilerplate for starting React projects, leveraging Vite for fast builds, TypeScript for type safety, and built-in support for internationalization, SVG handling, and code quality tools like ESLint, Husky, and Prettier.

Table of Contents

Features

Version used for Major Dependencies

PackageVersion
node22.8.0
react18.3.1
vite5.4.1
typescript5.5.3
eslint9.10.0
husky8.0.0
prettier3.3.3
typescript-eslint8.5.0
@eslint/js9.10.0
vite-tsconfig-paths5.0.1
i18next23.15.1
i18next-browser-languagedetector8.0.0
react-dom18.3.1
react-i18next15.0.2
@svgr/cli8.1.0
npm10.8.3
lint-staged15.2.10

This template serves as a solid foundation to kickstart new React projects, ensuring consistency, efficiency, and adherence to best practices across the team.

Project Folder Structure

.
├── .github                      # GitHub-specific workflows and templates
├── .husky                       # Husky pre-commit hooks (e.g., linting, testing)
├── .vscode                      # VSCode workspace settings and recommended extensions
├── src                          # Source files for the project
│   ├── assets                   # Static resources (images, fonts, etc.)
│   ├── components               # Reusable React components
│   ├── constants                # Application-wide constants
│   ├── https                    # HTTPS utility functions (API calls, etc.)
│   ├── pages                    # Page-level components
│   ├── routes                   # Application routes
│   ├── svgr                     # SVG to React components configuration
│   │   ├── index-template.cjs   # Template for exporting SVG components
│   │   ├── svgr-config.json     # SVGR configuration file
│   │   └── svgr-template.cjs    # Template for converting individual SVGs into React components
│   ├── theme                    # Theming files for typography, colors, spacing, etc.
│   └── types                    # TypeScript types
├── .editorconfig                # EditorConfig for consistent coding styles across IDEs
├── .envrc                       # Environment configuration using direnv
├── .gitignore                   # Git ignore file
├── .nvmrc                       # Node.js version configuration
├── .prettierignore              # Ignore file for Prettier
├── .prettierrc                  # Prettier configuration
├── .validate-branch-namerc.json # Configuration for validating branch names
├── commitlint.config.cjs        # Commit message linting configuration
├── eslint.config.js             # ESLint configuration
├── index.html                   # Main HTML file for the project
├── package.json                 # Project dependencies and scripts
├── package-lock.json            # Lockfile for package dependencies
├── README.md                    # Project readme
├── tsconfig.app.json            # TypeScript configuration for application code
├── tsconfig.json                # General TypeScript configuration
├── tsconfig.node.json           # TypeScript configuration for Node.js
└── vite.config.ts               # Vite configuration file

Naming Conventions

Getting Started

Follow these steps to clone, set up, and start working with the project:

1. Clone the Repository

Use degit to clone the boilerplate template:

npx degit Aubergine-FE/react-basic-template <your-project-name>

2. Install direnv for the default environment

For macOS (Homebrew):

brew install direnv

For Ubuntu:

sudo apt install direnv
Setup the terminal for the default environment using the official website.
You can setup your desired node version in .nvmrc file.

Go into your project

cd your-project-name

# give permissions to direnv
direnv allow

3. Install dependencies

npm install

4. Git Hooks with Husky

Initialize the git repository

git init

Install the husky to setup the hooks.

npx husky@8.0.0 install

# now, you have running hooks setup in place.

Hooks can be disabled with:

npm run disable-hooks

Changed your mind? Enable hooks with:

npm run enable-hooks

5. Change the prefix of branch name and commit message

6. Configure Internationalization

7. Configure SVGR for your project

8. Update the README.template.md file

Contributing

License