create-react-pwa
https://github.com/facebookincubator/create-react-app + Progressive Web App goodness
Top Related Projects
Set up a modern web app by running one command.
🔥 A highly scalable, offline-first foundation with the best developer experience and a focus on performance and best practices.
The web's most popular Jamstack front-end template (boilerplate) for building web applications with React
React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in
Get started with React, Redux, and React-Router.
Quick Overview
Create React PWA is a project template for building Progressive Web Apps (PWAs) using React. It provides a solid foundation for developers to create modern, offline-capable web applications with React, leveraging the power of service workers and other PWA technologies.
Pros
- Easy setup and configuration for creating React-based PWAs
- Includes service worker integration for offline functionality
- Provides a good starting point for developers new to PWAs
- Regularly updated to incorporate the latest React and PWA best practices
Cons
- Limited customization options out of the box
- May require additional configuration for more complex PWA features
- Documentation could be more comprehensive
- Some users report occasional issues with the build process
Code Examples
- Creating a new React PWA project:
npx create-react-app my-pwa --template pwa
This command uses Create React App with the PWA template to set up a new project.
- Registering the service worker:
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
serviceWorkerRegistration.register();
This code registers the service worker, enabling offline functionality and other PWA features.
- Customizing the Web App Manifest:
{
"short_name": "My PWA",
"name": "My Progressive Web App",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
This JSON configuration in the manifest.json
file defines the app's appearance and behavior when installed on a device.
Getting Started
To get started with Create React PWA:
- Install Node.js and npm if not already installed.
- Run the following command to create a new React PWA project:
npx create-react-app my-pwa --template pwa
- Navigate to the project directory:
cd my-pwa
- Start the development server:
npm start
Your React PWA will now be running locally. You can begin customizing the app by editing the files in the src
directory.
Competitor Comparisons
Set up a modern web app by running one command.
Pros of create-react-app
- Widely adopted and maintained by Facebook, ensuring regular updates and community support
- Comprehensive tooling and configuration out-of-the-box, simplifying the setup process
- Extensive documentation and resources available for developers
Cons of create-react-app
- Larger bundle size and potentially slower initial load times
- Less focus on Progressive Web App (PWA) features by default
- More opinionated structure, which may not suit all project requirements
Code Comparison
create-react-app:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
create-react-pwa:
import React from 'react';
import { render } from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
render(<App />, document.getElementById('root'));
registerServiceWorker();
The main difference in the code is that create-react-pwa includes a service worker registration by default, emphasizing its focus on PWA features. create-react-app provides a more generic setup without built-in PWA capabilities.
create-react-app is better suited for general React application development, offering a robust ecosystem and extensive tooling. create-react-pwa, on the other hand, is tailored for developers specifically interested in building Progressive Web Apps with React, providing PWA features out-of-the-box.
🔥 A highly scalable, offline-first foundation with the best developer experience and a focus on performance and best practices.
Pros of react-boilerplate
- More comprehensive and feature-rich, offering a complete development environment
- Includes advanced features like Redux, reselect, and ImmutableJS out of the box
- Provides a scalable architecture suitable for large-scale applications
Cons of react-boilerplate
- Steeper learning curve due to its complexity and numerous integrated technologies
- May be overkill for smaller projects or those not requiring all included features
- Requires more setup and configuration compared to simpler alternatives
Code Comparison
create-react-pwa:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
react-boilerplate:
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'connected-react-router';
import history from 'utils/history';
import App from 'containers/App';
import configureStore from './configureStore';
const store = configureStore({}, history);
ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<App />
</ConnectedRouter>
</Provider>,
document.getElementById('app')
);
The code comparison highlights the simplicity of create-react-pwa versus the more complex setup in react-boilerplate, which includes Redux integration and connected routing.
The web's most popular Jamstack front-end template (boilerplate) for building web applications with React
Pros of react-starter-kit
- More comprehensive and feature-rich, offering a full-stack solution
- Includes GraphQL integration and server-side rendering out of the box
- Provides a more structured and opinionated project setup
Cons of react-starter-kit
- Steeper learning curve due to its complexity and additional features
- May be overkill for simpler projects or those not requiring a full-stack solution
- Less focused on Progressive Web App (PWA) features compared to create-react-pwa
Code Comparison
react-starter-kit:
import React from 'react';
import Layout from '../../components/Layout';
import Home from './Home';
const title = 'React Starter Kit';
const component = () => (
<Layout>
<Home title={title} />
</Layout>
);
create-react-pwa:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
The code comparison shows that react-starter-kit uses a more structured approach with separate layout components, while create-react-pwa focuses on a simpler setup with emphasis on service worker registration for PWA functionality.
React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in
Pros of react-slingshot
- More comprehensive boilerplate with additional tools and configurations
- Includes testing setup with Jest and Enzyme
- Provides a production build process with minification and bundling
Cons of react-slingshot
- Potentially overwhelming for beginners due to its extensive feature set
- May include unnecessary features for simpler projects
- Requires more setup and configuration compared to create-react-pwa
Code Comparison
react-slingshot:
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { Router, browserHistory } from 'react-router';
import routes from './routes';
create-react-pwa:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
The code comparison shows that react-slingshot includes additional imports for Redux and React Router, indicating a more feature-rich setup. In contrast, create-react-pwa has a simpler entry point, focusing on the core React application and service worker registration.
react-slingshot offers a more comprehensive development environment with additional tools and configurations, making it suitable for larger projects. However, it may be overkill for simpler applications. create-react-pwa provides a more streamlined approach, focusing on Progressive Web App features, which could be beneficial for projects prioritizing offline capabilities and performance.
Get started with React, Redux, and React-Router.
Pros of react-redux-starter-kit
- More comprehensive setup with Redux integration out of the box
- Includes testing setup with Karma, Mocha, and Chai
- Offers a more opinionated structure for larger applications
Cons of react-redux-starter-kit
- Less focus on Progressive Web App (PWA) features
- May be overwhelming for beginners or smaller projects
- Last updated in 2017, potentially outdated dependencies
Code Comparison
create-react-pwa:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
react-redux-starter-kit:
import React from 'react'
import ReactDOM from 'react-dom'
import createStore from './store/createStore'
import App from './components/App'
const store = createStore(window.__INITIAL_STATE__)
const MOUNT_NODE = document.getElementById('root')
ReactDOM.render(
<App store={store} />,
MOUNT_NODE
)
The code comparison shows that create-react-pwa focuses on a simpler setup with service worker registration for PWA features, while react-redux-starter-kit emphasizes Redux store creation and integration with the main App component.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
DEPRECATED
Similar functionality is now part of the official create-react-app
project: https://github.com/facebookincubator/create-react-app/pull/1728
Top Related Projects
Set up a modern web app by running one command.
🔥 A highly scalable, offline-first foundation with the best developer experience and a focus on performance and best practices.
The web's most popular Jamstack front-end template (boilerplate) for building web applications with React
React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in
Get started with React, Redux, and React-Router.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot