A modern React application template built with Create React App, providing a solid foundation for building scalable web applications.
- Features
- Getting Started
- Installation
- Available Scripts
- Project Structure
- Technologies Used
- Contributing
- License
- Contact
- Fast development setup with Create React App
- Development server with hot reload
- Production build optimization
- Built-in testing environment
- Modern JavaScript features
- Progressive Web App (PWA) ready
- TypeScript support
- ESLint and Prettier configuration
- Git hooks with Husky
- Automated testing with Jest and React Testing Library
- Responsive design ready
- API integration examples
- State management setup
- Route protection
- Error boundary implementation
- Lazy loading components
- Performance optimization
- Node.js (version 14 or higher)
- npm or yarn package manager
- Git
- Clone the repository
git clone https://github.com/yourusername/your-project-name.git- Navigate to the project directory
cd your-project-name- Install dependencies
npm installor
yarn install- Create environment file
cp .env.example .env- Start the development server
npm startor
yarn startβββ public/ # Static files
β βββ index.html # HTML template
β βββ favicon.ico # Favicon
β βββ manifest.json # PWA manifest
βββ src/
β βββ components/ # Reusable UI components
β β βββ common/ # Common components
β β βββ layout/ # Layout components
β β βββ forms/ # Form components
β βββ pages/ # Page components
β βββ assets/ # Static assets
β β βββ images/ # Images
β β βββ fonts/ # Fonts
β β βββ styles/ # Global styles
β βββ utils/ # Utility functions
β βββ hooks/ # Custom React hooks
β βββ context/ # React Context providers
β βββ services/ # API services
β βββ types/ # TypeScript types
β βββ constants/ # Constants and configurations
β βββ store/ # State management
β βββ routes/ # Route definitions
β βββ App.tsx # Root component
β βββ index.tsx # Entry point
βββ .env # Environment variables
βββ .eslintrc # ESLint configuration
βββ .prettierrc # Prettier configuration
βββ tsconfig.json # TypeScript configuration
βββ jest.config.js # Jest configuration
βββ package.json # Dependencies and scripts
βββ README.md # Project documentation
-
Core:
- React 18
- TypeScript
- React Router Dom v6
- Axios
-
State Management:
- Redux Toolkit
- React Query
- Context API
-
Styling:
- Styled Components
- CSS Modules
- TailwindCSS
-
Testing:
- Jest
- React Testing Library
- Cypress
-
Development Tools:
- ESLint
- Prettier
- Husky
- Commitlint
Create a .env file in the root directory:
REACT_APP_API_URL=your_api_url
REACT_APP_ENV=development
REACT_APP_GOOGLE_ANALYTICS_ID=your_ga_id// src/config/api.config.ts
export const API_CONFIG = {
baseURL: process.env.REACT_APP_API_URL,
timeout: 5000,
headers: {
'Content-Type': 'application/json',
},
};- Fork the repository
- 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
We follow Conventional Commits:
feat: add new feature
fix: bug fix
docs: update documentation
style: formatting, missing semi colons, etc
refactor: refactoring code
test: adding tests
chore: maintain
This project is PWA-ready. To customize:
- Update
public/manifest.json:
{
"short_name": "React App",
"name": "React Project Template",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}- Configure service worker in
src/service-worker.ts
Mukul meena Email - mukul.meena@iitgn.ac.in Personal - mukulmee771@gmail.com github Link: https://github.com/yourusername
- Initial release
- Basic project structure
- Core features implemented
- Testing setup complete
- Documentation added
- Add authentication system
- Implement dark mode
- Add internationalization
- Improve test coverage
- Add CI/CD pipeline
- Performance optimization
- Analytics integration
- Error tracking
- Accessibility improvements
Create a new component in src/components:
// src/components/Button/Button.tsx
import React from 'react';
import styled from 'styled-components';
interface ButtonProps {
variant?: 'primary' | 'secondary';
children: React.ReactNode;
onClick?: () => void;
}
const StyledButton = styled.button<ButtonProps>`
padding: 8px 16px;
border-radius: 4px;
background-color: ${props =>
props.variant === 'primary' ? '#007bff' : '#6c757d'};
color: white;
border: none;
cursor: pointer;
`;
export const Button: React.FC<ButtonProps> = ({
variant = 'primary',
children,
onClick,
}) => (
<StyledButton variant={variant} onClick={onClick}>
{children}
</StyledButton>
);Use the API service:
// src/services/api.ts
import axios from 'axios';
import { API_CONFIG } from '../config/api.config';
const api = axios.create(API_CONFIG);
export const fetchData = async <T>(endpoint: string): Promise<T> => {
const response = await api.get<T>(endpoint);
return response.data;
};Update the router configuration:
// src/routes/index.tsx
import { Routes, Route } from 'react-router-dom';
import { PrivateRoute } from './PrivateRoute';
import { Home, About, Dashboard } from '../pages';
export const AppRoutes = () => (
<Routes>
<Route path="/" element={<Home />} />
<Route path="/about" element={<About />} />
<Route
path="/dashboard"
element={
<PrivateRoute>
<Dashboard />
</PrivateRoute>
}
/>
</Routes>
);