This repository contains two React templates for starting a project with modern tooling, including Vite, SWC, Vitest, Redux Toolkit, etc. The templates are organized into separate folders and are available on the branch. These templates can be used as a solid starting point for building a React application with the latest tooling and best practices.
This template contains the following:
- Vite
- React
- SWC
- Styled Components
- svgr
- Vitest
- Testing Library
- Eslint
- Prettier
- lint-staged
This template contains the following:
- Vite
- React
- SWC
- Styled Components
- svgr
- Vitest
- Testing Library
- Eslint
- Prettier
- lint-staged
- Redux Toolkit
To use the templates, follow the steps below:
-
Install degit:
pnpm add -g degit
-
Clone the repository:
- Base Template:
degit https://github.com/dragenet/ts-vite-react-template.git/base <target-dir>
- With Redux Toolkit:
degit https://github.com/dragenet/ts-vite-react-template.git/with-redux-toolkit <target-dir>
- Base Template:
-
Change directory to the desired template:
cd <target-dir>
-
Initialize git:
git init
-
Install dependencies:
pnpm install
-
Start the development server:
pnpm dev
Each template has the following file and folder structure (excluding store directory):
βββ index.html
βββ package.json
βββ pnpm-lock.yaml
βββ public
βΒ Β βββ vite.svg
βββ src
βΒ Β βββ main.tsx
βΒ Β βββ App.tsx
βΒ Β βββ assets
βΒ Β βββ components
βΒ Β βΒ Β βββ molecules
βΒ Β βΒ Β βΒ Β βββ Helmet
βΒ Β βΒ Β βΒ Β βββ RootProvider
βΒ Β βΒ Β βββ templates
βΒ Β βΒ Β βββ HomePageTemplate
βΒ Β βββ pages
βΒ Β βΒ Β βββ Home.tsx
βΒ Β βββ router
βΒ Β βββ store (*only for with-redux-toolkit template)
βΒ Β βΒ Β βββ apis
βΒ Β βΒ Β βββ hooks
βΒ Β βΒ Β βΒ Β βββ useAppDispatch.ts
βΒ Β βΒ Β βΒ Β βββ useAppSelector.ts
βΒ Β βΒ Β βββ rootStore.ts
βΒ Β βΒ Β βββ slices
βΒ Β βββ theme
βΒ Β βββ types
βΒ Β βΒ Β βββ env.d.ts
βΒ Β βββ utils
βΒ Β βββ test
βΒ Β βββ renderTest.tsx
βΒ Β βββ withTestRouter.tsx
βββ tsconfig.json
βββ tsconfig.node.json
βββ vite.config.ts
βββ vitest.setup.ts
If you find any bug or have any suggestion, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE.md file for details.