This React Boilerplate is structured to provide a clean and understandable framework for building scalable and maintainable React applications. It outlines a suggested folder structure that categorizes different aspects of a React application for better organization and efficiency.
Below is an outline of the folder structure that this boilerplate recommends:
project-name/
│
├── src/
│ ├── components/
│ │ ├── ui/
│ │ │ ├── Button.tsx
│ │ │ ├── TextInput.tsx
│ │ │ └── ...
│ │ └── ...
│ │
│ ├── hooks/
│ │ ├── useCustomHook1.ts
│ │ ├── useCustomHook2.ts
│ │ └── ...
│ │
│ ├── pages/
│ │ ├── Page1.tsx
│ │ ├── Page2.tsx
│ │ └── ...
│ │
│ ├── services/
│ │ ├── ApiService.ts
│ │ ├── ContextService.ts
│ │ └── ...
│ │
│ ├── utils/
│ │ ├── utilFunction1.ts
│ │ ├── utilFunction2.ts
│ │ └── ...
│ │
│ ├── App.tsx
│ └── index.tsx
│
└── README.md
-
/pages
: This folder contains all the page components of your application. Each page component corresponds to a route. -
/components
: This folder contains all the components which are unique and may or may not utilise files from thecomponents/ui
directory. -
/components/ui
: This sub-folder inside thecomponents
directory houses reusable UI components like buttons, text inputs, and other UI elements. -
/hooks
: Custom React hooks used throughout the application are placed in this folder. This helps in reusing logic and maintaining clean code. -
/services
: Contains all services that the application consumes, such as API calls, context providers, and state management setups. -
/utils
: This folder includes utility functions and helpers that do not fall into the other categories but are still essential for the operation of the application.
To get a local copy up and running follow these simple steps.
git clone https://github.com/yourusername/react-boilerplate.git
cd react-boilerplate
npm install
npm run dev
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 would like to contribute to the project, please follow these steps:
- Fork the Project: Navigate to the repository on GitHub and click the "Fork" button at the top right corner.
- Create your Feature Branch: After forking, clone your fork to your local machine and create a branch for your new feature.
git checkout -b feature/AmazingFeature
- Commit your Changes: Make the necessary changes or additions to the project and commit them. Try to write clear and concise commit messages. bash
git commit -m 'Add some AmazingFeature'
- Push to the Branch: Push your changes to your GitHub repository. bash
git push origin feature/AmazingFeature
- Open a Pull Request: Go back to the original repository and open a pull request from your feature branch to the main branch. Provide a description of your changes and how they improve the project.
Thank you for considering contributing to the project, and we look forward to your contributions!
Distributed under the MIT License.