Code Monkey home page Code Monkey logo

offline-first-demo's Introduction

Offline-first demo

What this is

Just a quick demo thrown together to demonstrate some functionalities of Progressive Web Apps with the Offline-first pattern in mind.

At the moment it uses Firebase, Material-UI and React.

To run

  • You'll need to have git and node 6+ installed in your system.
  • You'll also need to create a project in Firebase and get the API key. Sign up for a free account. Then go into project settings and find the API key and paste it into the config.json in src/config. To ensure that you don't accidentally commit your config.json to Github, run:
git update-index --assume-unchanged src/config/config.json
  • Fork and clone the project:
git clone THIS_REPO_URL
  • Then install the dependencies:
npm install
  • Run development server:
npm start

Open the web browser to http://localhost:8888/

To build production package

npm run build

Notes about sw-precache (deprecated - see below)

sw-precache is a project created by some developers at Google to help adding Service Workers to a web app to begin to make it a Progressive Web App.

With the sw-precache config, you specify what files you want to precache and the generated service-worker.js file handles the whole lifecycle. The only extra thing you as a dev need to do, is to handle registration of the SW. If you have a look at service-worker.jsx in src/components, you can see an example of this.

The generated service-worker.js file does not handle everything that a Service Worker is capable of doing however. You would need to import your own scripts if you want to do more advanced things such as Push Notifications, Background Syncing, caching of AJAX files, etc.

Notes about serviceworker-webpack-plugin

The project now uses the serviceworker-webpack-plugin. You can write any service-worker functions you want into src/sw.js.

To-do

  • Refactor service-worker.jsx to not be a stateful component
  • Add redux for state management
  • Add PouchDB and switch between firebase or PouchDB

offline-first-demo's People

Contributors

alicoding avatar greenkeeperio-bot avatar k3a avatar michaelknoch avatar jikkujose avatar connor11528 avatar pavds avatar leoromanovsky avatar mrienstra avatar radek-novak avatar duncanchen avatar holmesal avatar daannijkamp avatar hugodias avatar yahkob avatar dabit3 avatar httpete-ire avatar thiagoxvo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.