A lightweight, fast, and customizable React starter kit. This minimalist toolkit gives you full control over your React application without the overhead of Create React App or Vite.
-
β‘ Lightning fast builds with esbuild-loader (10-100x faster than babel-loader)
-
π¦ Optimized bundle size with modern Webpack 5 configuration
-
π§Ή ESLint configured with strict best practices
-
π Hot Module Replacement for rapid development
-
π§© Code Splitting built-in for optimal loading
-
π² Tree Shaking to eliminate unused code
-
ποΈ Fully customizable - add only what you need
-
π JSDoc support for better IDE integration
# Clone the repository
git clone https://github.com/rayanalheraki/react-lite-app-startkit.git
cd react-lite-app-startkit
# Install dependencies
npm install
# Start development server
npm start
Visit http://localhost:3000 to see your app in action.
-
npm start- Start the development server -
npm run build- Build for production (output todistfolder) -
npm run build:win- Build for production on Windows -
npm run lint- Check for linting issues -
npm run lint:fix- Fix automatic linting issues
react-lite-app-startkit/
βββ public/ # Static files
β βββ index.html # HTML template
βββ src/ # Source code
β βββ components/ # React components
β βββ App.jsx # Main App component
β βββ index.js # Application entry point
βββ .eslintrc.js # ESLint configuration
βββ .gitignore # Git ignore rules
βββ package.json # Dependencies and scripts
βββ webpack.config.js # Webpack configuration
# For Sass
npm install --save-dev sass sass-loader
Update webpack.config.js:
// Add to module.rules array
{
test: /\.s[ac]ss$/i,
use: [
'style-loader',
'css-loader',
'sass-loader',
],
}npm install react-router-dom
npm uninstall react react-dom
npm install preact
Update webpack.config.js:
// Add to resolve.alias
alias: {
'react': 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
}import React, { Suspense, lazy } from 'react';
// Lazy load components
const LazyComponent = lazy(() => import('./components/LazyComponent'));
function App() {
return (
<Suspense fallback={<div>Loading...</div>}>
<LazyComponent />
</Suspense>
);
}In webpack.config.js:
resolve: {
alias: {
'@components': path.resolve(__dirname, 'src/components/'),
'@utils': path.resolve(__dirname, 'src/utils/')
}
}Even without TypeScript, you can get type checking benefits with JSDoc:
/**
* A button component with customizable text and click handler
*
* @param {Object} props - Component props
* @param {string} props.text - Button text
* @param {Function} props.onClick - Click handler function
* @param {string} [props.className] - Optional CSS class
* @returns {React.Element} Button component
*/
function Button({ text, onClick, className = '' }) {
return (
<button className={`button ${className}`} onClick={onClick}>
{text}
</button>
);
}
// Don't forget to add PropTypes
Button.propTypes = {
text: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
className: PropTypes.string,
};This starter kit comes with a comprehensive ESLint configuration that enforces best practices for React:
-
Modern React patterns
-
Prop validation
-
Code quality with SonarJS
-
Accessibility checks with jsx-a11y
-
Import optimization
-
Promise handling
You can customize the rules in .eslintrc.js to match your team's coding standards.
-
Lightweight: No unnecessary dependencies
-
Fast: Uses esbuild-loader for near-instant builds
-
Flexible: Easily add or remove features
-
Modern: Built with the latest best practices
-
Maintainable: Strong linting rules for code quality
-
Transparent: No hidden configuration, everything is in plain sight
-
Customizable: Full control over your tooling
If you later decide to add TypeScript:
- Install TypeScript and type definitions:
npm install --save-dev typescript @types/react @types/react-dom
-
Create a
tsconfig.jsonfile -
Rename
.jsand.jsxfiles to.tsand.tsx -
Update webpack configuration
See other TypeScript version of this starter kit for a complete example.
This starter kit is configured to support modern browsers. For older browser support, consider adding appropriate polyfills and adjusting the Webpack configuration.
MIT