aj-react-template
aj-react-template copied to clipboard
React + Vite + SWC + ts + tailwind + redux | Project template with basic configurations
React + TypeScript + Vite + Tailwind + ReduxToolkit
This template provides a minimal setup to get React working in Vite with HMR and ESLint rules. You can use this project as a quick-start setup with the following configurations:
- React
- TypeScript
- Vite + SWC
- Tailwind CSS
- Redux
- Axios
- Module creation script
How to start
-
Clone the project
git clone https://github.com/albin-joseph/aj-react-template.git <project_name>Replace <project_name> with the desired name for your project.
-
Remove existing git history
If you want to use the template as a fresh project, remove the existing .git history:
cd <project_name>rm -rf .git -
Reinitialize Git
Reinitialize Git for your new project:
git initgit add .git commit -m "Initialize project from template" -
Install Dependencies
install the required packages using npm or yarn:
npm installor
yarn install -
Update Project-Specific Details
- Open
package.jsonand update the following fields:- "name": Set a unique name for your project.
- "version": Update the version if needed.
- "description", "author", etc.
- Check for any template-specific configuration or placeholders.
- Open
-
Set Up Environment Variables
If the template includes an
.env.examplefile, create a.envfile:cp .env.example .envUpdate the .env file with project-specific values.
-
Start the Development Server
npm run dev -
Push to Your Own Git Repository
If you want to host the project in your own repository:
- Create a new repository on GitHub, GitLab, or any other Git hosting service.
- Add it as a remote
git remote add origin <your-repository-url>git branch -M maingit push -u origin main -
Customize the Template
Start modifying the template code to suit your project needs.
How to Create a New Module
<module-name>.page: Handles state management, lifecycle methods, and API calls.<module-name>.view: Base visual/presentation view; includes subcomponents based on the UI design.<module-name>Slice: Redux implementation.<module-name>.service: Module-specific API implementations.<module-name>.utils: Contains utility methods.componentsfolder: Stores all module-related subcomponents.
Automated Module Creation
To create a new module, run:
npm run create-module <module-name>
Example:
For the Home module:
npm run create-module Home
Note:
- Based on your Node.js and npm version mismatch, there is a chance of conflicts occurring. Please address such conflicts carefully.
- You can add additional configurations as needed for your project.