All Projects → rossta → serviceworker-rails-sandbox

rossta / serviceworker-rails-sandbox

Licence: MIT license
Service Workers on Rails demo app with the serviceworker-rails gem

Programming Languages

ruby
36898 projects - #4 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to serviceworker-rails-sandbox

Pwafire
Progressive Web Apps API of APIs
Stars: ✭ 137 (+55.68%)
Mutual labels:  service-worker
Png Pong
An image manipulation library with a very specific set of skills.
Stars: ✭ 190 (+115.91%)
Mutual labels:  service-worker
Jfa Pwa Toolkit
⚡️ PWA Features to Any Website (very Fast & Easy)
Stars: ✭ 245 (+178.41%)
Mutual labels:  service-worker
Learning Pwa
📱some samples and blogs about how to start with your first PWA
Stars: ✭ 162 (+84.09%)
Mutual labels:  service-worker
Fetch Progress Indicators
Progress indicators/bars using Streams, Service Workers, and Fetch APIs
Stars: ✭ 181 (+105.68%)
Mutual labels:  service-worker
Progressive Weather App
A local weather app that fetches weather forecast from Openweathermap.org. A Progressive Web App built with Vue.js.
Stars: ✭ 223 (+153.41%)
Mutual labels:  service-worker
Pwa
Progressive Web Apps for Rails
Stars: ✭ 133 (+51.14%)
Mutual labels:  service-worker
HowSlow
A Service Worker that monitors network requests to estimate bandwidth and RTT
Stars: ✭ 38 (-56.82%)
Mutual labels:  service-worker
Awesome Cloudflare
⛅️ Curated list of awesome Cloudflare worker recipes, open-source projects, guides, blogs and other resources.
Stars: ✭ 186 (+111.36%)
Mutual labels:  service-worker
So Pwa
A progressive web app to read Stack Overflow content.
Stars: ✭ 235 (+167.05%)
Mutual labels:  service-worker
Notes
Offline-first notepad PWA
Stars: ✭ 163 (+85.23%)
Mutual labels:  service-worker
Pwatter
Angular Progressive Web App using Workbox
Stars: ✭ 167 (+89.77%)
Mutual labels:  service-worker
Ember Service Worker
A pluggable approach to Service Workers for Ember.js
Stars: ✭ 227 (+157.95%)
Mutual labels:  service-worker
Generator Jekyll Starter Kit
🚀 Jekyll Progressive Web App Generator.
Stars: ✭ 139 (+57.95%)
Mutual labels:  service-worker
Hnpwa Vanilla
Hacker News PWA implemented using no framework just javascript
Stars: ✭ 245 (+178.41%)
Mutual labels:  service-worker
Monitaure
🔔 A server uptime monitoring progressive web application - NO LONGER MAINTAINED
Stars: ✭ 135 (+53.41%)
Mutual labels:  service-worker
Streamsaver.js
StreamSaver writes stream to the filesystem directly asynchronous
Stars: ✭ 2,784 (+3063.64%)
Mutual labels:  service-worker
project-acorn-ssr
A Vue.js SPA built around the WordPress REST API with Vuex, Vue Router, Axios and SSR.
Stars: ✭ 14 (-84.09%)
Mutual labels:  service-worker
Offline First
🔌 Everything you need to know to create offline-first web apps.
Stars: ✭ 2,792 (+3072.73%)
Mutual labels:  service-worker
Productivity Frontend
Productivity Application - Kanban Style Productivity Management Application with Customizable Boards, Lists and Cards to Make You More Productive.
Stars: ✭ 234 (+165.91%)
Mutual labels:  service-worker

Service Workers on Rails

This sandbox demonstrates various use cases for "Service Workers on Rails". Integration of Service Workers with the Rails asset pipeline is provided by the serviceworker-rails gem.

Background

The Service Worker API is coming. Service Workers are scripts that act as a proxy between the browser and the server. Among other things, Service Workers can be used to:

  • enable the creation of effective offline experiences
  • increase perceived performance while online
  • access push notifications and background sync APIs.

Service Workers are scripts that live outside the context of a rendered page. This means that there are some considerations for hosting Service Workers:

  • service workers must be served over HTTPS
  • service workers must be served within the "scope" of the page(s) they control (pending override capability)
  • service workers should not be cached: browsers install service workers in the background so requesting and evaluating these scripts will not tie up page rendering

Rails integration

So you want to use Service Workers in your Rails app? Consider that the Rails asset pipeline bundles JavaScript assets so that they're typically finger-printed, heavily cached, and served out of the /assets directory. While we'd like to take advantage of the asset pipeline for transpiling our Service Worker scripts just like any other JavaScript assets, we need flexibility for how these assets are served to the client.

This is where the serviceworker-rails gem comes in. Using serviceworker-rails in your Rails app allows you to map Service Worker endpoints to bundled Rails assets and adds the appropriate (configurable) response headers. You can still take advantage of Rails pipeline with Service Workers in development and production!

The sandbox serviceworker initializer in config/initializers/serviceworker.rb provides several examples for customizing how service worker endpoints should map to assets in the Rails asset pipeline. Corresponding serviceworker implementations for the examples can be found in app/assets/javascripts.

Resources

Examples in this sandbox are inspired by a variety of resources:

Development

Check out the project with git, run bundle install and copy the database.yml.example to database.yml and edit to fit your needs.

You could also try running with Docker. The docker-compose.yml assumes the existence of an .env.docker file. You may want copy the .env.docker.example file and set up your own environment variables. Assuming you have Docker installed and running, you could simply try running docker-compose up. YMMV.

If desired, for certain features you'll need Twitter app credentials. Example keys can be found in .env.docker.example.

Good luck!

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rossta/serviceworker-rails-sandbox. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].