1. Web service worker is by default enabled in the project created by latest create-react-app. However, npm start do not enable web service workers (for better dev experience as no cache). Instead, you should (npm install -g serve if cmd serve not installed):

    npm run build
    serve -T -s build
    
  2. To solve the following error when testing the app locally:

    DOMException: Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script
    

    Please open the chrome with extra options, e.g.

    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https://localhost:5000 --user-data-dir=/tmp/foo
    
  3. You can view the PWA status (e.g. the data stored in Local Storage/IndexedDB) by Chrome dev console (the Application tab);

  4. You can evaluate your PWA by Google lighthouse tool which is also availiable by Chrome dev console (the Audits tab); lighthouse

  5. Use library like pouchDB to save your app state into local computer storage, so that your PWA can work offline as normal.