Starter kit for modern web applications
React-PWA is an opinionated starter kit for building Progressive Web Applications with React. Designed to streamline development, it combines essential libraries, components, utilities, and developer tools to accelerate your workflow.
Building a modern web application requires a robust setup, including routing, UI components, theming, error handling, a structured file system, testing tools, and performance optimizations. React-PWA provides a production-ready, minimal, and efficient environment for developers to focus on creating great applications.
| Technology | Version | Description |
|---|---|---|
| Vite | v6 | Fast build tool based on ES modules, Rollup, and esbuild |
| React | v19 | Latest version with all modern features |
| TypeScript | Latest | Type-safe JavaScript for better development |
| MUI | v6 | Comprehensive UI framework with MUI |
# Clone the repository
git clone https://github.com/suren-atoyan/react-pwa.git
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run prettier:check |
Check formatting |
npm run lint:check |
Check linting |
npm run ts:check |
Check TypeScript |
npm run test:unit |
Run unit tests |
npm run test:e2e |
Run e2e tests |
npm run test:e2e:ui |
Run e2e tests in UI mode |
npm run preview |
Preview production build locally |
npm run https-preview |
Preview with HTTPS |
react-pwa/
├── ...
├── src/
│ ├── components/ # Reusable UI components
│ ├── config/ # Application configuration
│ ├── error-handling/ # Error management
│ ├── hooks/ # Custom hooks
│ ├── pages/ # Application pages/routes
│ ├── routes/ # Routing configuration
│ ├── sections/ # Self-contained application sections
│ ├── theme/ # Theme configuration
│ └── utils/ # Utility functions
└── ...Each component follows this structure:
ComponentName/
├── index.ts # Default exports the component
├── ComponentName.tsx # Pure component implementation
├── types.ts # Component-related types (optional)
├── styled.ts # Styled components (optional)
└── utils.ts # Component-specific utilities (optional)MUI ensures consistency, accessibility, and performance while remaining highly customizable to match your brand's design language.
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import { styled } from '@mui/material/styles';
// styled components
const NewButton = styled(Button)(({ theme }) => ({
marginRight: theme.spacing(1),
color: theme.palette.text.disabled,
}));
// sx prop
function MyComponent() {
return ...;
}The theme system is based on MUI Theme, supporting dark/light modes and customization.
import { useThemeMode } from '@/theme';
function MyComponent() {
const { themeMode, toggle } = useThemeMode();
return Toggle Theme;
}Jotai provides simple atoms-based state management for cross-application state, complementing React's useState and data fetching libraries.
Utilizes MUI Toolpad’s useNotification for handling alerts in an elegant, customizable way:
function MyComponent() {
const notifications = useNotifications();
function showNotification() {
notifications.show('Operation successful!', {
autoHideDuration: 5000,
});
}
}Alt+s: Toggle theme modeAlt+t: Toggle sidebarAlt+/: Open hotkeys dialogvite.config.ts)The withErrorHandler HOC catches errors and displays friendly fallback UIs:
// In your component:
export default withErrorHandler(MyComponent);
// Or for the entire app:
export default withErrorHandler(App);npm run test:unitnpm run test:e2e
# or with UI
npm run test:e2e:uiPlace your environment variables in a .env file (prefixed with VITE_):
env/ directoryimport.meta.env.VITE_VARIABLE_NAMEA UI library ensures consistency, accessibility, and development efficiency. Without one, teams would need to create and maintain basic components from scratch, leading to inconsistencies and wasted time.
React applications have different state management needs:
useState for local UI interactionsuseQuery or Apollo for remote dataButton, List, etc.)Navigation, Sidebar, etc.)TypeScript reduces runtime errors, improves code maintainability, and enhances developer experience with static typing and better IDE support.
Prettier enforces consistent style across all contributors, reducing discussions in PR reviews and ensuring code quality.
Check out the live demo
No open issues yet, or sync has not completed.